- 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.
This commit is contained in:
Edoardo Prezioso 2015-05-02 13:46:34 +02:00
parent c75a762e7e
commit 4217c2ccd6

View file

@ -312,6 +312,10 @@ FString level_info_t::LookupLevelName()
{ {
mysnprintf (checkstring, countof(checkstring), "%d: ", atoi(&MapName[5])); mysnprintf (checkstring, countof(checkstring), "%d: ", atoi(&MapName[5]));
} }
else
{
checkstring[0] = '\0';
}
thename = strstr (lookedup, checkstring); thename = strstr (lookedup, checkstring);
if (thename == NULL) if (thename == NULL)
{ {