From: Amos Jeffries Date: Sun, 3 Feb 2013 14:08:46 +0000 (-0700) Subject: Fix segmentation fault on missing squid.conf values X-Git-Tag: SQUID_3_3_1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b314ec0e39804ffe797f3badca4e9705e1c2e0d8;p=thirdparty%2Fsquid.git Fix segmentation fault on missing squid.conf values Directves expecting percentage values may segfault when no value token is supplied. Detected by Coverity Scan. Issue 970941 --- diff --git a/src/Parsing.cc b/src/Parsing.cc index ab67afa198..2ed440b1f0 100644 --- a/src/Parsing.cc +++ b/src/Parsing.cc @@ -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 == '%') {