From: Alex Rousskov Date: Mon, 8 Sep 2025 06:40:02 +0000 (+0000) Subject: Do not assert when debugging SNMP requests with long OIDs (#2150) X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=97ddc09010276780b90d38061f68c32c59da7ade;p=thirdparty%2Fsquid.git Do not assert when debugging SNMP requests with long OIDs (#2150) FATAL: assertion failed: MemBuf.cc: "new_cap > (size_t) capacity" Also fixes repeated same-buffer snmpDebugOid() calls that used to accumulate stale content in snmpTreeNext(): snmpTreeNext: Current : .1.3.6.1.4.1.3495 snmpTreeNext: Next : .1.3.6.1.4.1.3495.1.3.6.1.4.1.3495.1.1.1.0 Current snmpDebugOid() callers have been checked for compatibility with this fix. Fixing snmpDebugOid() API is out of this surgical fix scope. --- diff --git a/src/snmp_core.cc b/src/snmp_core.cc index a031b8bf6c..db78b1164f 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -1065,8 +1065,7 @@ snmpDebugOid(oid * Name, snint Len, MemBuf &outbuf) { char mbuf[16]; int x; - if (outbuf.isNull()) - outbuf.init(16, MAX_IPSTRLEN); + outbuf.reset(); for (x = 0; x < Len; ++x) { size_t bytes = snprintf(mbuf, sizeof(mbuf), ".%u", (unsigned int) Name[x]);