Don't write into buffer if no arguments, reported by Filipe Rosset.

This commit is contained in:
Nicholas Marriott 2014-02-26 21:42:59 +00:00
parent 6d9f936ff2
commit 0bb9d51965

3
cmd.c
View File

@ -138,6 +138,9 @@ cmd_pack_argv(int argc, char **argv, char *buf, size_t len)
size_t arglen;
int i;
if (argc == 0)
return (0);
*buf = '\0';
for (i = 0; i < argc; i++) {
if (strlcpy(buf, argv[i], len) >= len)