]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Do not assert when debugging SNMP requests with long OIDs (#2150)
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 8 Sep 2025 06:40:02 +0000 (06:40 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 8 Sep 2025 06:40:12 +0000 (06:40 +0000)
    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.

src/snmp_core.cc

index a031b8bf6c9dcc3f0b4b62c2c9848f21ed672cc8..db78b1164fa58757dba5e8338d0aaf82d9fe0c19 100644 (file)
@@ -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]);