From 4a6bc37e70240643fce872d406c83f566c6291c5 Mon Sep 17 00:00:00 2001 From: pwpiwi Date: Mon, 10 Apr 2017 18:39:33 +0200 Subject: [PATCH] fix missing terminating 0 in my_executable_directory (thanks @iceman1001). fix warning about const used twice in get_my_executable_path() and get_my_executable_directory(). --- client/proxmark3.c | 5 +++-- client/proxmark3.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/client/proxmark3.c b/client/proxmark3.c index 2ed127a4..98f7880e 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -199,12 +199,12 @@ static void dumpAllHelp(int markdown) static char *my_executable_path = NULL; static char *my_executable_directory = NULL; -const char const *get_my_executable_path(void) +const char *get_my_executable_path(void) { return my_executable_path; } -const char const *get_my_executable_directory(void) +const char *get_my_executable_directory(void) { return my_executable_directory; } @@ -219,6 +219,7 @@ static void set_my_executable_path(void) my_executable_path[path_length] = '\0'; my_executable_directory = (char *)malloc(dirname_length + 2); strncpy(my_executable_directory, my_executable_path, dirname_length+1); + my_executable_directory[dirname_length+1] = '\0'; } } } diff --git a/client/proxmark3.h b/client/proxmark3.h index 2d19cf5c..3f7c3004 100644 --- a/client/proxmark3.h +++ b/client/proxmark3.h @@ -17,7 +17,7 @@ #define PROXPROMPT "proxmark3> " void SendCommand(UsbCommand *c); -const char const *get_my_executable_path(void); -const char const *get_my_executable_directory(void); +const char *get_my_executable_path(void); +const char *get_my_executable_directory(void); #endif -- 2.39.5