Bound the sizes of strcpy.
authorNHOrus <jy6x2b32pie9@yahoo.com>
Sat, 8 Jul 2017 19:06:23 +0000 (22:06 +0300)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 8 Jul 2017 19:16:21 +0000 (15:16 -0400)
actions.c
main.c

index 0aa7d9302decd3ed14d01719a5e8441d299b883d..80e534b6da793c2cebbb8e8a274dcbb75d918078 100644 (file)
--- 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 c3fc353c22281231c0db22ed137416c8d2868435..6457d055068984a423d0cf575d5a167c8039bbd3 100644 (file)
--- 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;