From 288ac4b07c82bcd40d8f54fa0063a854e3c65a77 Mon Sep 17 00:00:00 2001 From: David Cohrs Date: Thu, 28 Jan 2016 18:38:53 -0800 Subject: [PATCH] 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. --- doc/fixes36.1 | 1 + src/files.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 8bd585e21..738f2f451 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -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 diff --git a/src/files.c b/src/files.c index c367e6d15..f8a767257 100644 --- a/src/files.c +++ b/src/files.c @@ -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; -- 2.40.0