From 8ebc44ee81ec9c36a5732b5a369c97db263fcf0f Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sat, 27 Apr 2019 16:52:23 +0200 Subject: [PATCH] fix segfault --- client/proxmark3.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/proxmark3.c b/client/proxmark3.c index 010fd6ff0..47ea28e36 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -62,9 +62,11 @@ main_loop(char *script_cmds_file, char *script_cmd, bool pm3_present) { char *cmd = NULL; bool execCommand = (script_cmd != NULL); - uint16_t script_cmd_len = strlen(script_cmd); - if (execCommand) + uint16_t script_cmd_len = 0; + if (execCommand) { + script_cmd_len = strlen(script_cmd); strcreplace(script_cmd, script_cmd_len, ';', '\0'); + } bool stdinOnPipe = !isatty(STDIN_FILENO); FILE *sf = NULL; char script_cmd_buf[256] = {0x00}; // iceman, needs lua script the same file_path_buffer as the rest