]> granicus.if.org Git - nethack/commitdiff
parse_conf_file fix fix
authorPatR <rankin@nethack.org>
Tue, 17 Dec 2019 23:41:58 +0000 (15:41 -0800)
committerPatR <rankin@nethack.org>
Tue, 17 Dec 2019 23:41:58 +0000 (15:41 -0800)
src/files.c

index 5e500ae3a208beb35d5135b838e80ff518f873eb..a25a038e660a79c865305b9c7fb35d8e92064833 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 files.c $NHDT-Date: 1574116097 2019/11/18 22:28:17 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.272 $ */
+/* NetHack 3.6 files.c $NHDT-Date: 1576626110 2019/12/17 23:41:50 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.276 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Derek S. Ray, 2015. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -3160,7 +3160,8 @@ boolean FDECL((*proc), (char *));
                         free(buf);
                     }
                     buf = strcat(tmpbuf, ep);
-                    buf[sizeof inbuf - 1] = '\0';
+                    if (strlen(buf) >= sizeof inbuf)
+                        buf[sizeof inbuf - 1] = '\0';
                 }
 
                 if (morelines || (ignoreline && !oldline))