]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
Avoid a crash in "script list" (#521)
authorPierre Pronchery <khorben@defora.org>
Thu, 28 Dec 2017 07:37:09 +0000 (08:37 +0100)
committerpwpiwi <pwpiwi@users.noreply.github.com>
Thu, 28 Dec 2017 07:37:09 +0000 (08:37 +0100)
This command crashes if the path to the executable directory could not
be found.

client/cmdscript.c

index 23163aa98f128918b153c80a8ef26930519ca98c..0d19f49697a4f47304eb4edc338a31be93ed7e9a 100644 (file)
@@ -76,8 +76,11 @@ int CmdList(const char *Cmd)
 {
     DIR *dp;
     struct dirent *ep;
-       char script_directory_path[strlen(get_my_executable_directory()) + strlen(LUA_SCRIPTS_DIRECTORY) + 1];
-       strcpy(script_directory_path, get_my_executable_directory());
+       char const * exedir = get_my_executable_directory();
+       if (exedir == NULL)
+           return 0;
+       char script_directory_path[strlen(exedir) + strlen(LUA_SCRIPTS_DIRECTORY) + 1];
+       strcpy(script_directory_path, exedir);
        strcat(script_directory_path, LUA_SCRIPTS_DIRECTORY);
     dp = opendir(script_directory_path);
 
Impressum, Datenschutz