]> granicus.if.org Git - nethack/commitdiff
avoid crash for long lines in nethackrc
authorDavid Cohrs <davecohrs@gmail.com>
Fri, 29 Jan 2016 02:38:53 +0000 (18:38 -0800)
committerDavid Cohrs <davecohrs@gmail.com>
Fri, 29 Jan 2016 02:40:59 +0000 (18:40 -0800)
read_config_file() has used a buffer of size (4 * BUFSZ) since 3.4.x
so parse_config_line() needs a buffer of the same size to avoid
buffer overrun. Allows my old .nethackrc to work again.

doc/fixes36.1
src/files.c

index 8bd585e21b6096c96f2f5d9cf0ef1820502d0c19..738f2f451bbe96f9493d6aead8c6112c7e2fd5a4 100644 (file)
@@ -13,6 +13,7 @@ message when cursed wand zapped by a monster happens to explode was suppressed
        if hero was deaf, even though that message has no audible component
 support explicit 'symset:default' and 'symset:Default symbols' in options
 crash during startup if player name set as 'player' in defaults
+crash during startup if defaults file has a long line
 any existing vampire shape-shifted into critter (fog cloud, bat, wolf) became
        an unkillable critter if vampires were genocided
 unlike in previous versions, an uncursed scroll of enchant armor failed to
index c367e6d155fa34e32dbea5f9f492ee1d8d5f7b3c..f8a767257853f4a0c46e2ded1cdbe2b219255220 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 files.c $NHDT-Date: 1452992318 2016/01/17 00:58:38 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.201 $ */
+/* NetHack 3.6 files.c $NHDT-Date: 1454035130 2016/01/29 02:38:50 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.202 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -2100,7 +2100,7 @@ int src;
 #ifdef SYSCF
     int n;
 #endif
-    char *bufp, *altp, buf[BUFSZ];
+    char *bufp, *altp, buf[4 * BUFSZ];
     uchar translate[MAXPCHARS];
     int len;