Fix overflowing on nul character.
PR: bin/16926 MFC after: 1 week
This commit is contained in:
parent
f83a4e8171
commit
f332550d02
@ -1062,7 +1062,7 @@ main(int argc, char *argv[])
|
||||
/* Have now read in the data. Next get the message to be printed. */
|
||||
if (*argv) {
|
||||
for(i=0, j=0; i < argc; i++)
|
||||
j += strlen(argv[i]) + (i != 0);
|
||||
j += strlen(argv[i]) + 1;
|
||||
if ((message = malloc((size_t)j)) == NULL)
|
||||
err(1, "malloc");
|
||||
strcpy(message, *argv);
|
||||
|
Loading…
Reference in New Issue
Block a user