Changeset - r23544:ac6a6a81e4c4
[Not reviewed]
master
0 1 0
glx22 - 5 years ago 2019-03-26 21:50:56
glx22@users.noreply.github.com
Fix #6564: enforce types of arguments for station name strings (#7419)
1 file changed with 7 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/strings.cpp
Show inline comments
 
@@ -76,7 +76,10 @@ int64 StringParameters::GetInt64(WChar t
 
		return 0;
 
	}
 
	if (this->type != NULL) {
 
		assert(this->type[this->offset] == 0 || this->type[this->offset] == type);
 
		if (this->type[this->offset] != 0 && this->type[this->offset] != type) {
 
			DEBUG(misc, 0, "Trying to read string parameter with wrong type");
 
			return 0;
 
		}
 
		this->type[this->offset] = type;
 
	}
 
	return this->data[this->offset++];
 
@@ -1415,8 +1418,9 @@ static char *FormatString(char *buff, co
 
						}
 
					}
 

	
 
					int64 args_array[] = {STR_TOWN_NAME, st->town->index, st->index};
 
					StringParameters tmp_params(args_array);
 
					uint64 args_array[] = {STR_TOWN_NAME, st->town->index, st->index};
 
					WChar types_array[] = {0, SCC_TOWN_NAME, SCC_NUM};
 
					StringParameters tmp_params(args_array, 3, types_array);
 
					buff = GetStringWithArgs(buff, str, &tmp_params, last);
 
				}
 
				break;
0 comments (0 inline, 0 general)