components/net-snmp/patches/042.17758422.patch
branchs11u1-sru
changeset 3109 1940d0927363
equal deleted inserted replaced
3103:f0ad806e26ab 3109:1940d0927363
       
     1 This has been fixed in upstream version 5.7.2 (see README).
       
     2 http://sourceforge.net/p/net-snmp/code/ci/4d38895f459a1df24f68c4a60e4caf6a778d8c1f
       
     3 
       
     4 --- a/agent/mibgroup/agent/extend.c
       
     5 +++ b/agent/mibgroup/agent/extend.c
       
     6 @@ -473,10 +473,21 @@ extend_parse_config(const char *token, char *cptr)
       
     7              
       
     8      } else if (!strcmp( token, "sh"   ) ||
       
     9                 !strcmp( token, "exec" )) {
       
    10 -        if ( num_compatability_entries == max_compatability_entries )
       
    11 +        if ( num_compatability_entries == max_compatability_entries ) {
       
    12              /* XXX - should really use dynamic allocation */
       
    13 -            config_perror("No further UCD-compatible entries" );
       
    14 -        else
       
    15 +            netsnmp_old_extend *new_compatability_entries;
       
    16 +            new_compatability_entries = realloc(compatability_entries,
       
    17 +                             max_compatability_entries*2*sizeof(netsnmp_old_extend));
       
    18 +            if (!new_compatability_entries)
       
    19 +                config_perror("No further UCD-compatible entries" );
       
    20 +            else {
       
    21 +                memset(new_compatability_entries+num_compatability_entries, 0,
       
    22 +                        sizeof(netsnmp_old_extend)*max_compatability_entries);
       
    23 +                max_compatability_entries *= 2;
       
    24 +                compatability_entries = new_compatability_entries;
       
    25 +            }
       
    26 +        }
       
    27 +        if (num_compatability_entries != max_compatability_entries)
       
    28              compatability_entries[
       
    29                  num_compatability_entries++ ].exec_entry = extension;
       
    30      }
       
    31