Files
nethack/include
PatR 964fd0fdbd dynamic format strings vulnerable to user input
This adds new utility routine strNsubst(), a more versatile version
of the existing strsubst(), that can replace the Nth occurrence of
a substring rather than just the first, and replaces all occurrences
if N is 0.

When working on vampire shape-shifting messages a few days ago I
noticed that a constructed pline/sprintf format was vulnerable to
the player giving the vampire a name with '%' in it and included
a fix for that.  This fixes two other instances of the same
vulnerability:  a monster with reflection triggering a floating
eye's gaze and the hero using a silver weapon against a silver-
hating monster.

I didn't do a lot of experimenting with the failure, just assigned
the name "foo%s" to the floating eye or the weapon.  The resulting
feedback for the relevant messages was garbled due to parameters
being substituted in the wrong place.  When that caused there to be
too few arguments to satisfy the format, the final message included
"null" for the missing one rather than triggering a crash while
trying to format something arbitrary from the stack.

I don't think these bugs provided sufficient user control to be
vulnerable to stack manipulation that does something naughty.

I found the dynamic format strings by searching for "%%".  There
may be others scattered around the code which don't have that as
an indicator....
2017-06-07 11:39:24 -07:00
..
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:31 +09:00
2015-05-30 22:41:30 -07:00
2016-10-10 16:18:20 +03:00
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:15 +09:00
2016-01-15 21:05:58 -08:00
2015-10-17 13:15:46 +03:00
2015-10-17 12:28:52 +03:00
2017-02-19 15:33:27 +02:00
2016-02-19 10:41:35 -08:00
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:31 +09:00
2016-10-10 16:18:20 +03:00
2015-05-25 09:21:31 +09:00
2017-02-19 15:33:27 +02:00
2016-10-05 20:04:56 +03:00
2015-05-25 09:21:15 +09:00
2015-05-25 09:21:31 +09:00
2016-02-03 23:39:24 -08:00
2015-05-25 09:21:15 +09:00
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:31 +09:00
2015-10-17 13:15:46 +03:00
2015-11-17 02:26:17 -08:00
2015-11-17 02:26:17 -08:00
2015-05-25 09:21:31 +09:00
2016-10-10 16:18:20 +03:00
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:31 +09:00
2016-10-10 16:18:20 +03:00
2015-05-25 09:21:31 +09:00
2016-06-21 17:32:02 -07:00
2015-05-25 09:21:31 +09:00
2016-10-10 16:18:20 +03:00
2015-05-25 09:21:31 +09:00
2016-10-10 16:18:20 +03:00
2015-05-25 09:21:31 +09:00
2015-12-31 17:26:25 -05:00
2015-05-25 09:21:31 +09:00
2015-07-25 19:19:58 -07:00
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:31 +09:00
2015-11-17 02:26:17 -08:00
2015-12-17 08:46:04 +02:00
2015-05-25 15:49:44 -07:00
2015-05-25 09:21:15 +09:00
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:31 +09:00
2015-10-17 18:47:31 +03:00
2016-10-10 21:55:23 +03:00
2015-10-17 12:28:52 +03:00
2016-10-10 16:18:20 +03:00
2015-05-25 09:21:31 +09:00
2017-02-19 15:33:27 +02:00
2015-12-04 14:56:14 -08:00
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:31 +09:00
2016-10-10 16:18:20 +03:00
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:31 +09:00
2015-10-17 18:47:31 +03:00
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:31 +09:00
2016-10-10 16:18:20 +03:00
2016-03-04 00:13:23 -08:00
2015-05-25 09:21:31 +09:00
2015-05-25 09:21:31 +09:00
2016-06-01 05:58:22 -07:00
2015-10-17 18:47:31 +03:00