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 <noreply@anthropic.com>
This commit is contained in:
1 parent
e51bf90b63
commit
47df440998
1 file changed
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user