You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ext/snmp: snmp_init_mib() dereferences NULL when $mibdirs is omitted or null #25858
In ext/snmp/snmp.c (lines 1848-1865 on master), snmp_init_mib(?string $mibdirs = null) accepts optional nullable $mibdirs (Z_PARAM_PATH_STR_OR_NULL(mibdirs)), checks if (mibdirs != NULL) at line 1858, and then unconditionally calls netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS, ZSTR_VAL(mibdirs)) at line 1863. Calling snmp_init_mib() with no arguments or null evaluates ZSTR_VAL(NULL) (0x18) and segfaults.
Suggested fix: Guard netsnmp_ds_set_string(..., ZSTR_VAL(mibdirs)) with if (mibdirs != NULL).
The following code:
<?phpsnmp_init_mib();
Resulted in this output:
Segmentation fault (NULL pointer dereference in ZSTR_VAL(mibdirs))
Activity
ext/snmp: snmp_init_mib() crashes when $mibdirs is omitted or null