summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaleb James DeLisle <cjd@cjdns.fr>2023-04-18 15:14:08 +0200
committerGitHub <noreply@github.com>2023-04-18 15:14:08 +0200
commita26e3441d8ad7de74c58a181901137b986e2fb21 (patch)
treeade2c38cddc7fab638fa3c661ceafa0536c44501
parente2eb84791c7476d3c2a9a505b9baf41838520d0d (diff)
cjdns: Fix dangling pointer bug (#964)
Maintainer: @wfleurant Compile tested: builds for x86_64 Run tested: Build only testing Description: same build error seen on my machine as seen in #958 Whereas #961 removes the compiler warning, this fixes the underlying problem in the code. Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
-rw-r--r--cjdns/patches/030-fix-invalid-pointer.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/cjdns/patches/030-fix-invalid-pointer.patch b/cjdns/patches/030-fix-invalid-pointer.patch
new file mode 100644
index 0000000..ae988a9
--- /dev/null
+++ b/cjdns/patches/030-fix-invalid-pointer.patch
@@ -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,