fix add_menu_coloring() buffer overrun

Fix 'Bug 2' where too long MENUCOLOR=string in run-time config file
could overflow a local buffer and clobber the stack.

Theoretically a menu coloring regular expression could require a
bigger buffer but I don't think we need to try to support that.
255 characters minus the amount needed to specify color and/or
attributes should be ample.
This commit is contained in:
PatR
2020-01-13 19:26:53 -08:00
parent c35139e9ce
commit a842fda44c
2 changed files with 7 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.1 $ $NHDT-Date: 1578971847 2020/01/14 03:17:27 $
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.2 $ $NHDT-Date: 1578972411 2020/01/14 03:26:51 $
fixes36.5 contains a terse summary of changes made to 3.6.4 in order to
produce 3.6.5 as well as any post-release fixes in binaries.
@@ -8,6 +8,7 @@ General Fixes and Modified Features
-----------------------------------
have string_for_opt() return empty_optstr on failure
ensure existing callers of string_for_opt() check return value before using it
fix potential buffer overflow in add_menu_coloring()
Fixes to Post-3.6.4 Problems that Were Exposed Via git Repository