diff options
-rw-r--r-- | libcli.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -515,9 +515,12 @@ static int cli_parse_line(const char *line, char *words[], int max_words) { int len = p - word_start; - memcpy(ptr, word_start, len); - words[nwords++] = ptr; - ptr += len + 1; + if (len > 1) + { + memcpy(ptr, word_start, len); + words[nwords++] = ptr; + ptr += len + 1; /* buf is memset zero, so we just need to add +1 to get a null terminated word */ + } } if (!*p) |