From 25ea6c8f3c936d203001ca5120e86e737d0b1d5f Mon Sep 17 00:00:00 2001 From: Bart House Date: Tue, 2 Jul 2019 19:08:50 -0700 Subject: [PATCH] Fix crash that can occur in decode_mixed. If a player names an object with a name that ends in '\\', drops that object on the floor nearby and does a look at nearby objects, then the game will crash. This is caused by stack corruption when the decode loop skips over the decode string terminator. --- src/mapglyph.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mapglyph.c b/src/mapglyph.c index 079150657..347ff25a2 100644 --- a/src/mapglyph.c +++ b/src/mapglyph.c @@ -313,6 +313,15 @@ const char *str; #endif case '\\': break; + case '\0': + /* String ended with '\\'. This can happen when someone + names an object with a name ending with '\\', drops the + named object on the floor nearby and does a look at all + nearby objects. */ + /* brh - should we perhaps not allow things to have names + that contain '\\' */ + str = save_str; + break; } } *put++ = *str++;