]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix segmentation fault on missing squid.conf values
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 2 Feb 2013 11:01:45 +0000 (04:01 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 2 Feb 2013 11:01:45 +0000 (04:01 -0700)
Directves expecting percentage values may segfault when no value token
is supplied.

 Detected by Coverity Scan. Issue 970941

src/Parsing.cc

index ab67afa1986f697060575181daac7342c5cb1a3d..2ed440b1f0deceb73cef919582bcb29e1b1ba0db 100644 (file)
@@ -191,6 +191,11 @@ GetPercentage(void)
     int p;
     char *token = strtok(NULL, w_space);
 
+    if (!token) {
+        debugs(0, DBG_PARSE_NOTE(DBG_IMPORTANT), "ERROR: A percentage value is missing.");
+        self_destruct();
+    }
+
     //if there is a % in the end of the digits, we remove it and go on.
     char* end = &token[strlen(token)-1];
     if (*end == '%') {