Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#580 Buffer overrun with -u option by check_snmp.

release-1.4.15
open
nobody
5
2012-11-20
2012-11-20
one6f
No

Plugin Version (-V output): rested with check_snmp v1.4.16 (nagios-plugins 1.4.16) and v1.4.15

Plugin Name: check_snmp

Plugin Commandline showing issues:
./check_snmp -H 10.31.17.180 -C public -o "ifOperStatus.1,ifOperStatus.17,ifOperStatus.18,ifOperStatus.21,ifOperStatus.29" -u "port_1","port_17","port_18","port_21","port_29"
�� OK - up(1) port_1 up(1) port_17 up(1) port_18 up(1) port_21 up(1) port_29 |

If I leave out the last unit, "port_29", it shows SNMP OK

Operating System:Ubuntu 10.04 LTS
Architecture: 64bit
Compiler: tested with apt-get install or self compiled with gcc

Discussion

  • one6f
    one6f
    2012-11-20

    check_snmp output with a fifefold -u option

     
    Attachments
  • J. Bern
    J. Bern
    2012-11-20

    Additional information:
    -- Bug confirmed to exist in 1.4.14, 1.4.15 and 1.4.16 (from source on a CentOS 5.5 machine)
    -- apparently triggered by number of units provided (must be five or more)
    -- probably *not* related: Note difference in second "if" expression:

    # grep -n -A 2 'realloc (unitv' nagios-plugins-1.4.16/plugins/check_snmp.c
    779: unitv = realloc (unitv, unitv_size);
    780- if (unitv == NULL)
    781- die (STATE_UNKNOWN, _("Could not reallocate units [%d]\n"), (int)nunits);
    --
    791: unitv = realloc (unitv, unitv_size);
    792- if (units == NULL)
    793- die (STATE_UNKNOWN, _("Could not realloc() units\n"));

    # UNITS="port_1,port_17,port_18,port_21,port_29,port_4711,port_grr"
    # nagios-plugins-1.4.16/plugins/check_snmp $AUTH -o "$OIDS" -u "$UNITS" | hexdump -C | head -2
    00000000 db 5b b1 bf e3 5b b1 bf ed 5b b1 bf 11 20 4f 4b |.[...[...[... OK|
    00000010 20 2d 20 75 70 28 31 29 20 70 6f 72 74 5f 31 20 | - up(1) port_1 |