From: Amos Jeffries Date: Sat, 2 Feb 2013 11:01:45 +0000 (-0700) Subject: Fix segmentation fault on missing squid.conf values X-Git-Tag: SQUID_3_4_0_1~322 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f5bc7b154a925f7326bf64312db6358ca272863a;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 == '%') {