Solaris Version 11.4.5.3.0
net-snmp snmpd version 5.73
When 'snmpwalk -v1 -c public localhost hrSWInstalled' command is executed, snmpd daemon crashes with the attached stack trace.
The problem happens when CATEGORY field is missing or having empty value in pkginfo file of one of the installed packages.
The problem is happening due to the following reason:
Following line returns NULL pointer (swinst_pkginfo.c line# 185):
c = pkgparam( dp->d_name, "CATEGORY" );
Since c is NULL, the following line dumps core (swinst_pkginfo.c line# 191):
entry->swType = (NULL != strstr( c, "system"))
The solution is to check if c is not NULL and execute the strstr part.
The same problem was reported earlier and is fixed in Linux.
The bug id is: 2780
Please verify whether the patch below fixes this crash:
I have uploaded a patch which I have tested on Solaris.
The link to the patch is: https://sourceforge.net/p/net-snmp/patches/1390/
The same I am attaching here also for easy reference.
Patch 1390 has been committed on the v5.8 and master branches. Thanks for the patch!