Blame SOURCES/net-snmp-5.7.2-smux-invalid-headers.patch

b5ae06
1140236 - Segfault when starting snmpd
b5ae06
b5ae06
commit 95b87c7fe990869f6b4ce62c0b2f0382e47699a5
b5ae06
Author: Jan Safranek <jsafranek@users.sourceforge.net>
b5ae06
Date:   Thu Feb 19 15:14:10 2015 +0100
b5ae06
b5ae06
    Add extra check to throw away invalid SMUX messages.
b5ae06
    
b5ae06
    Otherwise snmpd crashes on NULL pointer dereference.
b5ae06
b5ae06
diff --git a/agent/mibgroup/smux/smux.c b/agent/mibgroup/smux/smux.c
b5ae06
index fd96710..02d02d2 100644
b5ae06
--- a/agent/mibgroup/smux/smux.c
b5ae06
+++ b/agent/mibgroup/smux/smux.c
b5ae06
@@ -752,6 +752,10 @@ smux_pdu_process(int fd, u_char * data, size_t length)
b5ae06
     while (error == 0 && ptr != NULL && ptr < data + length) {
b5ae06
         len = length - (ptr - data);
b5ae06
         ptr = asn_parse_header(ptr, &len, &type);
b5ae06
+        if (ptr == NULL) {
b5ae06
+            DEBUGMSGTL(("smux", "[smux_pdu_process] cannot parse header\n"));
b5ae06
+            break;
b5ae06
+        }
b5ae06
         DEBUGMSGTL(("smux", "[smux_pdu_process] type is %d\n",
b5ae06
                     (int) type));
b5ae06
         switch (type) {