From e61ff637eb96470e297875a975c6c2ec5b4e48cd Mon Sep 17 00:00:00 2001 From: Christopher Schwarz Date: Sat, 3 Oct 2009 12:42:33 +0000 Subject: * Cleanup info_validate function and enforce that connecting clients must pass it (with thanks to Byron Johnson) --- src/qcommon/q_shared.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/qcommon') diff --git a/src/qcommon/q_shared.c b/src/qcommon/q_shared.c index fc259219..07e3669c 100644 --- a/src/qcommon/q_shared.c +++ b/src/qcommon/q_shared.c @@ -1234,12 +1234,22 @@ can mess up the server's parsing ================== */ qboolean Info_Validate( const char *s ) { - if ( strchr( s, '\"' ) ) { - return qfalse; - } - if ( strchr( s, ';' ) ) { - return qfalse; + const char* ch = s; + + while ( *ch != '\0' ) + { + if( !Q_isprint( *ch ) ) + return qfalse; + + if( *ch == '\"' ) + return qfalse; + + if( *ch == ';' ) + return qfalse; + + ++ch; } + return qtrue; } -- cgit