]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix handling of bad SNMP variable type when parsing IP_* vars (#1097)
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 24 Jul 2022 18:56:53 +0000 (18:56 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 24 Jul 2022 20:11:16 +0000 (20:11 +0000)
AFAICT, we never associate snmp_netIpFn() with the wrong variable type,
so we may be dealing with a bug in an effectively unreachable code here.

1999 commit 736eb6a correctly removed snmp_var_free() call from most
refactored SNMP functions but missed snmp_netIpFn() and
snmp_meshCtblFn() cases. The latter was fixed in 2000 commit d20b1cd.

Detected by static analyzer Svace v3.2.1.

src/ipcache.cc

index 62fdfbf9644d6f98b7fdf3d4aeebb439533ede66..f03e579a42f3bdebf91efacbcddc0a077f724dbf 100644 (file)
@@ -1226,8 +1226,7 @@ snmp_netIpFn(variable_list * Var, snint * ErrP)
 
     default:
         *ErrP = SNMP_ERR_NOSUCHNAME;
-        snmp_var_free(Answer);
-        return (nullptr);
+        assert(!Answer);
     }
 
     return Answer;