mirror of
https://github.com/meshtastic/firmware.git
synced 2026-09-30 02:05:22 -04:00
Null-check reply allocations in allocErrorResponse and RemoteHardware (#11260)
allocAckNak returns nullptr when the packet pool is exhausted, but allocErrorResponse passed the result straight to setReplyTo, which dereferences it. Reachable unauthenticated: an ADMIN_APP packet on a known-key channel takes the NOT_AUTHORIZED path, so a flood that empties the pool crashes the node. MemoryDynamic::alloc no longer aborting on failure made this reachable on PSRAM, STM32WL and Portduino targets. Callers already treat a null reply as no response. Same fix for the two RemoteHardwareModule sites.
This commit is contained in:
1 parent
ae16c052d5
commit
80f972655d
2 files changed
+8
-3
No files matched your search
@@ -103,8 +103,10 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const meshtastic_MeshPacket &r
|
||||
r.gpio_value = res;
|
||||
r.gpio_mask = p.gpio_mask;
|
||||
meshtastic_MeshPacket *p2 = allocDataProtobuf(r);
|
||||
setReplyTo(p2, req);
|
||||
myReply = p2;
|
||||
if (p2) {
|
||||
setReplyTo(p2, req);
|
||||
myReply = p2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -149,7 +151,8 @@ int32_t RemoteHardwareModule::runOnce()
|
||||
r.type = meshtastic_HardwareMessage_Type_GPIOS_CHANGED;
|
||||
r.gpio_value = curVal;
|
||||
meshtastic_MeshPacket *p = allocDataProtobuf(r);
|
||||
service->sendToMesh(p);
|
||||
if (p)
|
||||
service->sendToMesh(p);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user