From 4217c2ccd68699fcdaad9dadc252becd1e672294 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sat, 2 May 2015 13:46:34 +0200 Subject: [PATCH] - Fixed a very old bug in LookupLevelName code. If the map name neither matched 'ExMy', 'MAPxy' or 'LEVELxy', 'checkstring' was left uninitialized before using as argument to 'strstr', leading to undefined results. Spotted with Valgrind. --- src/g_mapinfo.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 4d7b3c7d24..d26d2f45b3 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -312,6 +312,10 @@ FString level_info_t::LookupLevelName() { mysnprintf (checkstring, countof(checkstring), "%d: ", atoi(&MapName[5])); } + else + { + checkstring[0] = '\0'; + } thename = strstr (lookedup, checkstring); if (thename == NULL) {