Fix bsnmpd(1) crash with ill-formed Discovery message

RFC 3414 Section 4. Discovery specifies that a discovery request message has a
varBindList left empty. Nonetheless, bsnmpd(1) should not crash when receiving
a non-zero var-bindings list in a Discovery Request message.

PR:		255214
MFC after:	2 weeks
This commit is contained in:
Shteryana Shopova 2021-10-01 14:10:39 +03:00
parent 18c2139495
commit 8b959dd6a3

View File

@ -641,7 +641,7 @@ snmp_input_start(const u_char *buf, size_t len, const char *source,
pdu->engine.engine_boots = snmpd_engine.engine_boots;
pdu->engine.engine_time = snmpd_engine.engine_time;
}
} else if (usm_user->suser.auth_proto != SNMP_AUTH_NOAUTH &&
} else if (pdu->user.auth_proto != SNMP_AUTH_NOAUTH &&
(pdu->engine.engine_boots == 0 || pdu->engine.engine_time == 0)) {
snmpd_usmstats.not_in_time_windows++;
ret = SNMPD_INPUT_FAILED;