Changeset - r18940:d4d88e15e3de
[Not reviewed]
master
0 2 0
yexo - 12 years ago 2012-01-15 13:17:02
yexo@openttd.org
(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
2 files changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/newgrf_text.cpp
Show inline comments
 
@@ -1062,13 +1062,13 @@ uint RemapNewGRFStringControlCode(uint s
 

	
 
			case SCC_NEWGRF_ROTATE_TOP_4_WORDS:     _newgrf_textrefstack.RotateTop4Words(); break;
 
			case SCC_NEWGRF_PUSH_WORD:              _newgrf_textrefstack.PushWord(Utf8Consume(str)); break;
 
			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;
 
		}
 
	}
 

	
 
	switch (scc) {
 
		default: NOT_REACHED();
src/strings.cpp
Show inline comments
 
@@ -835,13 +835,13 @@ static char *FormatString(char *buff, co
 
				StringID substr = Utf8Consume(&str);
 
				str_stack.push(GetStringPtr(substr));
 
				break;
 
			}
 

	
 
			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;
 
				break;
 
			}
 

	
0 comments (0 inline, 0 general)