1
0
mirror of https://github.com/mist-devel/mist-firmware.git synced 2026-04-17 00:15:25 +00:00

usb: fix possible hang during parsing malformed device descriptor

This commit is contained in:
Eugene Lozovoy
2025-05-11 19:07:36 +03:00
parent d581a714db
commit 55a40e4ec6
3 changed files with 3 additions and 0 deletions

View File

@@ -323,6 +323,7 @@ static uint8_t asix_parse_conf(usb_device_t *dev, uint8_t conf, uint16_t len) {
}
// advance to next descriptor
if (!p->conf_desc.bLength || p->conf_desc.bLength > len) break;
len -= p->conf_desc.bLength;
p = (union buf_u*)(p->raw + p->conf_desc.bLength);
}

View File

@@ -245,6 +245,7 @@ static uint8_t pl2303_parse_conf0(usb_device_t *dev, uint16_t len) {
}
// advance to next descriptor
if (!p->conf_desc.bLength || p->conf_desc.bLength > len) break;
len -= p->conf_desc.bLength;
p = (union buf_u*)(p->raw + p->conf_desc.bLength);
}

View File

@@ -98,6 +98,7 @@ static uint8_t usb_xbox_parse_conf(usb_device_t *dev, uint8_t conf, uint16_t len
}
// advance to next descriptor
if (!p->conf_desc.bLength || p->conf_desc.bLength > len) break;
len -= p->conf_desc.bLength;
p = (union buf_u*)(p->raw + p->conf_desc.bLength);
}