# HG changeset patch # User yexo # Date 2012-01-15 13:17:02 # Node ID d4d88e15e3de1542361547d26bdc24aada32ed2e # Parent 8896d47b8fa6dc182359e98d4075fe8d8d969d17 (svn r23804) -Fix: [NewGRF] Make string code 80 more secure by not crashing when it's used in strings where it's not supposed to be used diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -1065,7 +1065,7 @@ uint RemapNewGRFStringControlCode(uint s case SCC_NEWGRF_UNPRINT: *buff = max(*buff - Utf8Consume(str), buf_start); break; case SCC_NEWGRF_PRINT_WORD_STRING_ID: - *argv = TTDPStringIDToOTTDStringIDMapping(_newgrf_textrefstack.PopUnsignedWord()); + *argv = _newgrf_textrefstack.PopUnsignedWord(); break; } } diff --git a/src/strings.cpp b/src/strings.cpp --- a/src/strings.cpp +++ b/src/strings.cpp @@ -838,7 +838,7 @@ static char *FormatString(char *buff, co } case SCC_NEWGRF_PRINT_WORD_STRING_ID: { - StringID substr = args->GetInt32(SCC_NEWGRF_PRINT_WORD_STRING_ID); + StringID substr = TTDPStringIDToOTTDStringIDMapping(args->GetInt32(SCC_NEWGRF_PRINT_WORD_STRING_ID)); str_stack.push(GetStringPtr(substr)); case_index = next_substr_case_index; next_substr_case_index = 0;