diff options
author | rubidium <rubidium@openttd.org> | 2009-03-06 01:23:25 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-03-06 01:23:25 +0000 |
commit | 86ca408d469811d13a15d5c7a671feda38126eb0 (patch) | |
tree | 8972c2c7b9b1ab7c2b41b46cd9a44f1bb0fbd9bd /src/saveload | |
parent | c3a7e6b693716232fd2aefab3f36bd555620b563 (diff) | |
download | openttd-86ca408d469811d13a15d5c7a671feda38126eb0.tar.xz |
(svn r15626) -Fix [FS#2698]: UTF8 string handling could cause buffer overruns.
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/oldloader.cpp | 1 | ||||
-rw-r--r-- | src/saveload/saveload.cpp | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/saveload/oldloader.cpp b/src/saveload/oldloader.cpp index 7def93796..6912ca9b5 100644 --- a/src/saveload/oldloader.cpp +++ b/src/saveload/oldloader.cpp @@ -232,6 +232,7 @@ static inline bool CheckOldSavegameType(FILE *f, char *temp, const char *last, u bool ret = VerifyOldNameChecksum(temp, len); temp[len - 2] = '\0'; // name is nul-terminated in savegame, but it's better to be sure + str_validate(temp, last); return ret; } diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 31f3b3c2d..390f36b3c 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -33,6 +33,7 @@ #include "../statusbar_gui.h" #include "../fileio_func.h" #include "../gamelog.h" +#include "../string_func.h" #include "table/strings.h" @@ -631,6 +632,7 @@ static void SlString(void *ptr, size_t length, VarType conv) } ((char*)ptr)[len] = '\0'; // properly terminate the string + str_validate((char*)ptr, (char*)ptr + len); } } |