]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Fixed 2 potential buffer overflows in SearchInfostring
authormolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 30 Sep 2003 06:36:41 +0000 (06:36 +0000)
committermolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 30 Sep 2003 06:36:41 +0000 (06:36 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3514 d7cf8633-e32d-0410-b094-e92efae38249

common.c

index f9c2a5ae2c6546ab0524a018356c258e05bef68c..4ff60bb9d4c9fd97bb5ca0acd82315c5f84efe1a 100644 (file)
--- a/common.c
+++ b/common.c
@@ -898,7 +898,7 @@ char *SearchInfostring(const char *infostring, const char *key)
 
                        if (c == '\0')
                                return NULL;
-                       if (c == '\\')
+                       if (c == '\\' || key_ind == sizeof (crt_key) - 1)
                        {
                                crt_key[key_ind] = '\0';
                                break;
@@ -914,7 +914,7 @@ char *SearchInfostring(const char *infostring, const char *key)
                        {
                                c = *infostring++;
 
-                               if (c == '\0' || c == '\\')
+                               if (c == '\0' || c == '\\' || value_ind == sizeof (value) - 1)
                                {
                                        value[value_ind] = '\0';
                                        return value;