From 0f41b99c5e106e11708d0be478e7defb92f0a43a Mon Sep 17 00:00:00 2001 From: Darkvater Date: Tue, 20 Dec 2005 20:52:05 +0000 Subject: (svn r3322) - Fix: Network window crash when it receives invalid information for example from the integrated nightly, so validate the network-input when it is received - CodeChange: added str_validate(char *str) function that checks if a string contains only printable characters and if not, replaces those characters by question marks. Also move IsValidAsciiChar() to string.h --- string.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'string.c') diff --git a/string.c b/string.c index ee5f1152e..18428527d 100644 --- a/string.c +++ b/string.c @@ -57,3 +57,9 @@ char* CDECL str_fmt(const char* str, ...) if (p != NULL) memcpy(p, buf, len + 1); return p; } + +void str_validate(char *str) +{ + for (; *str != '\0'; str++) + if (!IsValidAsciiChar(*str)) *str = '?'; +} -- cgit v1.2.3-54-g00ecf