]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix NULL-dereference added in rev.12611
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 25 Jan 2013 23:44:49 +0000 (16:44 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 25 Jan 2013 23:44:49 +0000 (16:44 -0700)
* strto*() may be called without a value parameter when used simply to
  verify the content of a string is a valid conversion.

  Detected by Coverity Scan. Issue 970939.

compat/xstrto.cc

index 7dd72a8e3d4623f097fe922cd255c6c629b45ef9..1fffd5412ad7e6c908ebbcab4e77380fbcb6dfec 100644 (file)
@@ -85,11 +85,12 @@ xstrtoui(const char *s, char **end, unsigned int *value,
     bool ret;
 
     ret = xstrtoul(s, end, &v, min, max);
-    if (value != NULL)
+    if (value != NULL) {
         *value = v;
 
-    if (v != static_cast<unsigned long>(*value)) {
-        return false;
+        if (v != static_cast<unsigned long>(*value)) {
+            return false;
+        }
     }
 
     return ret;