mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-07 09:16:44 +10:00
Msg Retry fixes, channel message fixes. Notification fixes. Make more desktop friendly. Enhance retry algo. Fix predicted location clustering add retries to reactions and fix the reactions in private DMS centralize and cleanup code in var areas
This commit is contained in:
+13
-1
@@ -157,6 +157,12 @@ class Contact {
|
||||
return null;
|
||||
}
|
||||
final pubKey = reader.readBytes(pubKeySize);
|
||||
|
||||
// Guard: reject contacts with zeroed or mostly-zeroed public keys
|
||||
// (indicates corrupt flash storage on the firmware side)
|
||||
final zeroCount = pubKey.where((b) => b == 0).length;
|
||||
if (zeroCount > pubKeySize ~/ 2) return null;
|
||||
|
||||
final type = reader.readByte();
|
||||
final flags = reader.readByte();
|
||||
final pathLen = reader.readByte();
|
||||
@@ -166,6 +172,12 @@ class Contact {
|
||||
final pathBytes = reader.readBytes(maxPathSize).sublist(0, safePathLen);
|
||||
final name = reader.readCStringGreedy(maxNameSize);
|
||||
|
||||
// Guard: reject contacts with non-printable names (corrupt flash data)
|
||||
if (name.isNotEmpty &&
|
||||
name.codeUnits.every((c) => c < 0x20 || c == 0xFFFD)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final lastMod = reader.readUInt32LE();
|
||||
|
||||
double? lat, lon;
|
||||
@@ -182,7 +194,7 @@ class Contact {
|
||||
name: name.isEmpty ? 'Unknown' : name,
|
||||
type: type,
|
||||
flags: flags,
|
||||
pathLength: pathLen > 0 ? (pathLen > maxPathSize ? -1 : pathLen) : -1,
|
||||
pathLength: (pathLen == 0xFF || pathLen > maxPathSize) ? -1 : pathLen,
|
||||
path: pathBytes,
|
||||
latitude: lat,
|
||||
longitude: lon,
|
||||
|
||||
Reference in New Issue
Block a user