From: Alex Rousskov Date: Sun, 24 Jul 2022 18:56:53 +0000 (+0000) Subject: Fix handling of bad SNMP variable type when parsing IP_* vars (#1097) X-Git-Tag: SQUID_6_0_1~144 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ccea54529305f0cc69e4cddc63db68ba22285d04;p=thirdparty%2Fsquid.git Fix handling of bad SNMP variable type when parsing IP_* vars (#1097) 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. --- diff --git a/src/ipcache.cc b/src/ipcache.cc index 62fdfbf964..f03e579a42 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -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;