mirror of
https://github.com/coolsnowwolf/routing.git
synced 2025-05-26 06:24:15 +08:00
cjdns: Fix dangling pointer bug
This commit is contained in:
parent
3aefda75ae
commit
de13bb50db
23
cjdns/patches/030-fix-invalid-pointer.patch
Normal file
23
cjdns/patches/030-fix-invalid-pointer.patch
Normal file
@ -0,0 +1,23 @@
|
||||
--- a/net/SwitchPinger_admin.c
|
||||
+++ b/net/SwitchPinger_admin.c
|
||||
@@ -78,8 +78,10 @@ static void adminPing(Dict* args, void*
|
||||
uint32_t timeout = (timeoutPtr) ? *timeoutPtr : DEFAULT_TIMEOUT;
|
||||
uint64_t path;
|
||||
String* err = NULL;
|
||||
+ String* pathNotParsable = String_CONST("path was not parsable.");
|
||||
+ String* noOpenSlots = String_CONST("no open slots to store ping, try later.");
|
||||
if (pathStr->len != 19 || AddrTools_parsePath(&path, (uint8_t*) pathStr->bytes)) {
|
||||
- err = String_CONST("path was not parsable.");
|
||||
+ err = pathNotParsable;
|
||||
} else {
|
||||
struct SwitchPinger_Ping* ping = SwitchPinger_newPing(path,
|
||||
data,
|
||||
@@ -89,7 +91,7 @@ static void adminPing(Dict* args, void*
|
||||
context->switchPinger);
|
||||
if (keyPing && *keyPing) { ping->type = SwitchPinger_Type_KEYPING; }
|
||||
if (!ping) {
|
||||
- err = String_CONST("no open slots to store ping, try later.");
|
||||
+ err = noOpenSlots;
|
||||
} else {
|
||||
ping->onResponseContext = Allocator_clone(ping->pingAlloc, (&(struct Ping) {
|
||||
.context = context,
|
Loading…
Reference in New Issue
Block a user