Skip to content

Commit 2b16948

Browse files
committed
snmptrapd: Fix an integer overflow
Do not add one to the trap type if doing this would cause an integer overflow. Fixes: https://issues.oss-fuzz.com/issues/459029273
1 parent abbd671 commit 2b16948

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

apps/snmptrapd_handlers.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,9 @@ snmp_input(int op, netsnmp_session *session,
11281128
} else {
11291129
memcpy(trapOid, stdTrapOidRoot, sizeof(stdTrapOidRoot));
11301130
trapOidLen = OID_LENGTH(stdTrapOidRoot); /* 9 */
1131+
/* Drop packets with an invalid trap type. */
1132+
if (pdu->trap_type == LONG_MAX)
1133+
return 1;
11311134
trapOid[trapOidLen++] = pdu->trap_type+1;
11321135
}
11331136
break;

0 commit comments

Comments
 (0)