]> granicus.if.org Git - nethack/commit
fix pline.c potential buffer overruns
authorPatR <rankin@nethack.org>
Tue, 14 Jan 2020 10:52:34 +0000 (02:52 -0800)
committerPatR <rankin@nethack.org>
Tue, 14 Jan 2020 10:52:34 +0000 (02:52 -0800)
commitcdc598e8bdf725eb79265ff9e0e16ae779046b09
tree437785b932487eb318aa100ef312ed45b51e5e80
parent74de7d31e0a6b3e2ebd852e333fe66d212fd6a90
fix pline.c potential buffer overruns

Fix 'Bugs 4, 5, and 6' which all use a similar fix but would have
conflicts over '#define BIGBUFSZ' if committed separately.

Format ("short explanation %s", string_argument), where the
explanation always has modest length but the string is potentially
up to 4*BUFSZ in length, into a 5*BUFSZ buffer.  Then truncate the
result to at most BUFSZ-1 characters so that it can be safely passed
to interface-specific putstr() or raw_print().

Applies to pline(), raw_printf(), and config_error_add().  Also done
for impossible() although there's no evidence that its buffer could
be overflowed in a controlled manner.
doc/fixes36.5
src/pline.c