diff options
| author | sakumisu <[email protected]> | 2026-03-30 22:37:37 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2026-03-30 22:37:37 +0800 |
| commit | c5052c2288ecddab85e2699f04f19771a6008d94 (patch) | |
| tree | 0e9c68c35c81085d04ef5c05a7900084bf0bb08e | |
| parent | 9205d533608c84f5f6e586bb27d963fd72e89b16 (diff) | |
fix(security): add check for adb msg size
Signed-off-by: sakumisu <[email protected]>
| -rw-r--r-- | class/adb/usbd_adb.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/class/adb/usbd_adb.c b/class/adb/usbd_adb.c index 417439a8..cf7dbe88 100644 --- a/class/adb/usbd_adb.c +++ b/class/adb/usbd_adb.c @@ -114,10 +114,8 @@ void usbd_adb_bulk_out(uint8_t busid, uint8_t ep, uint32_t nbytes) (void)ep; if (adb_client.common_state == ADB_STATE_READ_MSG) { - if (nbytes != sizeof(struct adb_msg)) { - USB_LOG_ERR("invalid adb msg size:%d\r\n", (unsigned int)nbytes); - return; - } + USB_ASSERT(nbytes == sizeof(struct adb_msg)); + USB_ASSERT(rx_packet.msg.data_length <= sizeof(rx_packet.payload)); USB_LOG_DBG("command:%x arg0:%x arg1:%x len:%d\r\n", rx_packet.msg.command, |
