avoid crash for long lines in nethackrc

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.
This commit is contained in:
David Cohrs
2016-01-28 18:38:53 -08:00
parent b632247a74
commit 288ac4b07c
2 changed files with 3 additions and 2 deletions

View 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

View 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;