Commit Graph

12 Commits

Author SHA1 Message Date
nhmall
ee15f67a65 fixes36.5 update 2020-01-27 18:11:43 -05:00
Bart House
05455f7baa Fall back to executable path if we have trouble converting known path. 2020-01-25 17:07:45 -08:00
nhmall
92deddd6a3 use vsnprintf instead of vsprintf in pline.c 2020-01-20 16:09:00 -05:00
PatR
f3def5c0b9 command line triggered buffer overruns
Prevent extremely long command line arguments from overflowing local
buffers in raw_printf or config_error_add.  The increased buffer
sizes they recently got to deal with long configuration file values
aren't sufficient to handle command line induced overflows.

choose_windows(core): copy and truncate the window_type argument in
case it gets passed to config_error_add().

process_options(unix): report bad values with "%.60s" so that vsprintf
will implicitly truncate when formatted by raw_printf().
2020-01-20 16:08:59 -05:00
nhmall
a8208b44c8 fixes update 2020-01-16 10:18:37 -05:00
Pasi Kallinen
f4ab235b81 Prevent accessing outside the mons array
Fix another out-of-bounds error
Monster trying to decide if a tin could cure stoning looking at
a special or empty tin would do acidic(&mons[-1])
2020-01-16 10:14:16 -05:00
PatR
cdc598e8bd 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.
2020-01-14 02:52:34 -08:00
PatR
74de7d31e0 fix sym_val() buffer overrun
Fix 'Bug 3' where too long SYMBOL=string in run-time config file could
overflow a local buffer and clobber the stack.

Valid value is only one character long after processing an 'escaped'
encoded character which can be at most 6 characters (plus terminator):
backslash M backslash and up three digits.  If/when UTF8 gets added
the number of digits will increase.  Use a truncated copy of the input
(substantially bigger than 6+1); ignore any excess.
2020-01-14 02:05:14 -08:00
PatR
a842fda44c 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.
2020-01-13 19:26:53 -08:00
PatR
c35139e9ce fixes36.5 2020-01-13 19:17:35 -08:00
nhmall
25c9fb8d2f fixes update 2020-01-13 15:30:23 -05:00
nhmall
843bb5cfc9 landing spot for post-3.6.4 patches if needed
This is a landing spot.
2019-12-18 16:49:55 -05:00