Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 591194

Summary: net-analyzer/nagios-plugins-snmp: check_snmp_storage - segmentation fault when -w and -c is reversed and type not specified
Product: Gentoo Linux Reporter: Fredric Johansson <fredric.miscmail>
Component: Current packagesAssignee: Sysadmin Bugs <sysadmin>
Status: UNCONFIRMED ---    
Severity: normal CC: creffett, jstein, proxy-maint, sysadmin
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Attachments: Fix default type name if not given

Description Fredric Johansson 2016-08-13 15:55:28 UTC
Created attachment 443240 [details, diff]
Fix default type name if not given

check_snmp_storage segfaults when -T/--type is not given and -w and -c have reversed values for the default type. Segfaults occurs when it tries to print the error message:

$ gdb --args  /usr/lib64/nagios/plugins/check_snmp_storage -C my-own-community -H -m /usr/portage/distfiles -w 30 -c 10
Reading symbols from /usr/lib64/nagios/plugins/check_snmp_storage...done.
(gdb) r
Starting program: /usr/lib64/nagios/plugins/check_snmp_storage -C my-own-community -H -m /usr/portage/distfiles -w 30 -c 10

Program received signal SIGSEGV, Segmentation fault.
0x000003fff7789da5 in vfprintf () from /lib64/
(gdb) bt
#0  0x000003fff7789da5 in vfprintf () from /lib64/
#1  0x000003fff783f7e2 in __printf_chk () from /lib64/
#2  0x000002aaaaaac3c6 in printf (__fmt=<optimized out>) at /usr/include/bits/stdio2.h:104
#3  main (argc=<optimized out>, argv=<optimized out>) at check_snmp_storage.c:252

Attached patch assigns the plaintext type name to the variable if not given.