(svn r25555) -Fix [FS#5632]: [Script] Texts from scripts were not validated before they were shown, causing an assertion to trigger

This commit is contained in:
rubidium
2013-07-04 16:36:47 +00:00
parent 76566fde5b
commit 4c443bce5c
5 changed files with 24 additions and 0 deletions

View File

@@ -254,6 +254,18 @@ void str_validate(char *str, const char *last, StringValidationSettings settings
*dst = '\0';
}
/**
* Scans the string for valid characters and if it finds invalid ones,
* replaces them with a question mark '?'.
* @param str the string to validate
*/
void ValidateString(const char *str)
{
/* We know it is '\0' terminated. */
str_validate(const_cast<char *>(str), str + strlen(str) + 1);
}
/**
* Checks whether the given string is valid, i.e. contains only
* valid (printable) characters and is properly terminated.