Bound the sizes of strcpy.

This commit is contained in:
NHOrus 2017-07-08 22:06:23 +03:00 committed by Eric S. Raymond
parent a3ffa2455b
commit 53cb12b4d0
2 changed files with 2 additions and 2 deletions

View file

@ -1114,7 +1114,7 @@ static int say(struct command_t *command)
{ {
if (command->wd2 > 0) { if (command->wd2 > 0) {
command->wd1 = command->wd2; command->wd1 = command->wd2;
strcpy(command->raw1, command->raw2); strncpy(command->raw1, command->raw2, LINESIZE - 1);
} }
char word1[TOKLEN + 1]; char word1[TOKLEN + 1];
packed_to_token(command->wd1, word1); packed_to_token(command->wd1, word1);

2
main.c
View file

@ -1197,7 +1197,7 @@ Laction:
case GO_WORD2: case GO_WORD2:
/* Get second word for analysis. */ /* Get second word for analysis. */
command.wd1 = command.wd2; command.wd1 = command.wd2;
strcpy(command.raw1, command.raw2); strncpy(command.raw1, command.raw2, LINESIZE - 1);
wordclear(&command.wd2); wordclear(&command.wd2);
command.raw2[0] = '\0'; command.raw2[0] = '\0';
goto L2620; goto L2620;