17758422 50 or more exec options in snmpd.conf results in errors
authorTomas Klacko <tomas.klacko@oracle.com>
Mon, 31 Mar 2014 02:29:31 -0700
changeset 1800 a9e784d06f31
parent 1799 c207960a052c
child 1801 32bb3093fb56
17758422 50 or more exec options in snmpd.conf results in errors
components/net-snmp/patches/042.17758422.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/net-snmp/patches/042.17758422.patch	Mon Mar 31 02:29:31 2014 -0700
@@ -0,0 +1,31 @@
+This has been fixed in upstream version 5.7.2 (see README).
+http://sourceforge.net/p/net-snmp/code/ci/4d38895f459a1df24f68c4a60e4caf6a778d8c1f
+
+--- a/agent/mibgroup/agent/extend.c
++++ b/agent/mibgroup/agent/extend.c
[email protected]@ -473,10 +473,21 @@ extend_parse_config(const char *token, char *cptr)
+             
+     } else if (!strcmp( token, "sh"   ) ||
+                !strcmp( token, "exec" )) {
+-        if ( num_compatability_entries == max_compatability_entries )
++        if ( num_compatability_entries == max_compatability_entries ) {
+             /* XXX - should really use dynamic allocation */
+-            config_perror("No further UCD-compatible entries" );
+-        else
++            netsnmp_old_extend *new_compatability_entries;
++            new_compatability_entries = realloc(compatability_entries,
++                             max_compatability_entries*2*sizeof(netsnmp_old_extend));
++            if (!new_compatability_entries)
++                config_perror("No further UCD-compatible entries" );
++            else {
++                memset(new_compatability_entries+num_compatability_entries, 0,
++                        sizeof(netsnmp_old_extend)*max_compatability_entries);
++                max_compatability_entries *= 2;
++                compatability_entries = new_compatability_entries;
++            }
++        }
++        if (num_compatability_entries != max_compatability_entries)
+             compatability_entries[
+                 num_compatability_entries++ ].exec_entry = extension;
+     }
+