]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
made CL_SetInfo check for more forbidden characters (key now refuses any form of...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 3 Feb 2007 12:08:54 +0000 (12:08 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 3 Feb 2007 12:08:54 +0000 (12:08 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6781 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c

index 3086515dfb86f80d127afeca24e5c9375825d3c9..d9c700944edcee1a405ba2ab5c8e3b32e78e3432 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -193,7 +193,19 @@ void CL_ClearState(void)
 
 void CL_SetInfo(const char *key, const char *value, qboolean send, qboolean allowstarkey, qboolean allowmodel, qboolean quiet)
 {
-       if (strchr(key, '\"') || strchr(value, '\"') || (!allowstarkey && key[0] == '*') || (!allowmodel && (!strcasecmp(key, "pmodel") || !strcasecmp(key, "emodel"))))
+       int i;
+       qboolean fail = false;
+       if (!allowstarkey && key[0] == '*')
+               fail = true;
+       if (!allowmodel && (!strcasecmp(key, "pmodel") || !strcasecmp(key, "emodel")))
+               fail = true;
+       for (i = 0;key[i];i++)
+               if (key[i] <= ' ' || key[i] == '\"')
+                       fail = true;
+       for (i = 0;value[i];i++)
+               if (value[i] == '\r' || value[i] == '\n' || value[i] == '\"')
+                       fail = true;
+       if (fail)
        {
                if (!quiet)
                        Con_Printf("Can't setinfo \"%s\" \"%s\"\n", key, value);