From: NHOrus Date: Sat, 8 Jul 2017 19:06:23 +0000 (+0300) Subject: Bound the sizes of strcpy. X-Git-Tag: 2017-07-10~14 X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=commitdiff_plain;h=53cb12b4d084bc085fd2b22db886cc172b74e59c Bound the sizes of strcpy. --- diff --git a/actions.c b/actions.c index 0aa7d93..80e534b 100644 --- a/actions.c +++ b/actions.c @@ -1114,7 +1114,7 @@ static int say(struct command_t *command) { if (command->wd2 > 0) { command->wd1 = command->wd2; - strcpy(command->raw1, command->raw2); + strncpy(command->raw1, command->raw2, LINESIZE - 1); } char word1[TOKLEN + 1]; packed_to_token(command->wd1, word1); diff --git a/main.c b/main.c index c3fc353..6457d05 100644 --- a/main.c +++ b/main.c @@ -1197,7 +1197,7 @@ Laction: case GO_WORD2: /* Get second word for analysis. */ command.wd1 = command.wd2; - strcpy(command.raw1, command.raw2); + strncpy(command.raw1, command.raw2, LINESIZE - 1); wordclear(&command.wd2); command.raw2[0] = '\0'; goto L2620;