From 47df4409987fcdadcd62402a689edb04f653168f Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 9 Nov 2026 17:55:50 +0700 Subject: [PATCH] fix wrong NULL check after allocating executable directory set_my_executable_path() checked my_executable_path instead of the freshly allocated my_executable_directory, so a failed calloc led to strncpy on NULL. Found by cppcheck 2.22. Co-Authored-By: Claude Opus 5.5 --- client/src/proxmark3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/proxmark3.c b/client/src/proxmark3.c index 4e7791dc3..e1570204f 100644 --- a/client/src/proxmark3.c +++ b/client/src/proxmark3.c @@ -746,7 +746,7 @@ static void set_my_executable_path(void) { if (wai_getExecutablePath(my_executable_path, path_length, &dirname_length) != -1) { my_executable_path[path_length] = '\0'; my_executable_directory = (char *)calloc(dirname_length + 2, sizeof(uint8_t)); - if (my_executable_path == NULL) { + if (my_executable_directory == NULL) { PrintAndLogEx(WARNING, "Failed to allocate memory"); return; }