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 | 34bd9ee636b43d1851d27f92884769f8f25717be (patch) | |
tree | 8972c2c7b9b1ab7c2b41b46cd9a44f1bb0fbd9bd /src/saveload | |
parent | 9c6d6c0d0edba265c73c04901d0f2155173407b8 (diff) | |
download | openttd-34bd9ee636b43d1851d27f92884769f8f25717be.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); } } |