milan-avb: validate packet length before dereferencing SET_CONTROL value byte

This commit is contained in:
hackerman-kl 2026-04-19 07:39:03 +02:00
parent 0291895498
commit 09f9100ce7

View file

@ -150,6 +150,11 @@ static int handle_cmd_set_control_identify(struct aecp *aecp, struct descriptor
old_value_format = desc_formats; old_value_format = desc_formats;
value_req = (uint8_t *)control->payload; value_req = (uint8_t *)control->payload;
if (len < 0 || (size_t)len < sizeof(*h) + sizeof(*p) +
sizeof(*control) + CONTROL_LINEAR_UINT8_SIZE)
return reply_status(aecp, AVB_AECP_AEM_STATUS_BAD_ARGUMENTS,
m, len);
if (*value_req == desc_formats->current_value) { if (*value_req == desc_formats->current_value) {
return reply_success(aecp, m, len); return reply_success(aecp, m, len);
} }