From dbbc420d99a22a1547d1ce393795321ef451df5a Mon Sep 17 00:00:00 2001 From: dmiller Date: Sat, 30 Jul 2016 00:13:17 +0000 Subject: [PATCH] Avoid 1-byte buffer overflow due to not allocating for null terminator --- ncat/ncat_posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ncat/ncat_posix.c b/ncat/ncat_posix.c index c65e358a6..16e5e806d 100644 --- a/ncat/ncat_posix.c +++ b/ncat/ncat_posix.c @@ -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;