diff options
| author | Frédéric Desbiens <[email protected]> | 2025-09-29 08:44:00 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-09-29 08:44:00 +0100 |
| commit | f4de148a71bc39dd124dda71604be6db148ac7ec (patch) | |
| tree | 9599ed2c53650782e95fcb5e79a621bc7f21632b | |
| parent | b39da813adf98532fe65debfe7c9c0b6d7e1f292 (diff) | |
| parent | d4c3b96ae3ef7c27b5a7b9f1d58daae7f40acf87 (diff) | |
Merge commit from fork
Insert a remaining buffer length check before dereferencing the pointer
| -rw-r--r-- | addons/snmp/nxd_snmp.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/snmp/nxd_snmp.c b/addons/snmp/nxd_snmp.c index 6fac9bbf..9b555c8c 100644 --- a/addons/snmp/nxd_snmp.c +++ b/addons/snmp/nxd_snmp.c @@ -18587,6 +18587,20 @@ INT buffer_length; buffer_length -= (INT)length; /**** Now we are positioned in front of the security parameters field. ****/ + if (buffer_length < 2) + { + /* Increment the invalid packet error counter. */ + agent_ptr -> nx_snmp_agent_invalid_packets++; + + /* Increment the internal error counter. */ + agent_ptr -> nx_snmp_agent_internal_errors++; + + /* Release the packet. */ + nx_packet_release(packet_ptr); + + /* Return to caller. */ + return; + } /* Determine if there are security parameters. */ if ((buffer_ptr[0] == NX_SNMP_ANS1_OCTET_STRING) && (buffer_ptr[1])) |
