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-Tag: SQUID_7_2~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba3e552ff459e5570c33c727a01c6bfa929d581e;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 cc41fc727d..f220dd45f2 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -1057,8 +1057,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]);