(svn r15626) -Fix [FS#2698]: UTF8 string handling could cause buffer overruns.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user