]> 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)
committerFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Mon, 8 Sep 2025 19:41:51 +0000 (20:41 +0100)
    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 cc41fc727df6fd1dc5d6837ef2578bca4f0179b7..f220dd45f239b4e4bd322d85f09a7abca5bb4b94 100644 (file)
@@ -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]);