1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-24 16:39:03 +00:00

Avoid 1-byte buffer overflow due to not allocating for null terminator

This commit is contained in:
dmiller
2016-07-30 00:13:17 +00:00
parent 367dc67f5a
commit dbbc420d99

View File

@@ -347,7 +347,7 @@ char **cmdline_split(const char *cmdexec)
/* The line is not empty so we've got something to deal with */
cmd_args = (char **) safe_malloc(sizeof(char *) * (max_tokens + 1));
cur_arg = (char *) Calloc(sizeof(char), strlen(cmdexec));
cur_arg = (char *) Calloc(sizeof(char), strlen(cmdexec) + 1);
/* Get and copy the tokens */
ptr = cmdexec;