diff options
Diffstat (limited to 'src/settings.cpp')
-rw-r--r-- | src/settings.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index 3095c6079..9b97107a3 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -506,7 +506,12 @@ static void Write_ValidateString(void *ptr, const SaveLoad *sld, const char *p) switch (GetVarMemType(sld->conv)) { case SLE_VAR_STRB: case SLE_VAR_STRBQ: - if (p != nullptr) strecpy((char*)ptr, (const char*)p, (char*)ptr + sld->length - 1); + if (p != nullptr) { + char *begin = (char*)ptr; + char *end = begin + sld->length - 1; + strecpy(begin, p, end); + str_validate(begin, end, SVS_NONE); + } break; case SLE_VAR_STR: |