Merge branch 'hristo-master-patch-93986' into 'master'

fix(esp_hid): Prevent DoS via malicious HID device descriptor

See merge request espressif/esp-idf!47096
This commit is contained in:
Hristo Gochkov
2026-04-24 14:41:57 +08:00

View File

@@ -353,6 +353,11 @@ esp_hid_report_map_t *esp_hid_parse_report_map(const uint8_t *hid_rm, size_t hid
}
}
temp_hid_report_map_t *map = s_temp_hid_report_map;
if (map == NULL) {
return NULL;
}
esp_hid_report_map_t *out = (esp_hid_report_map_t *)calloc(1, sizeof(esp_hid_report_map_t));
if (out == NULL) {
ESP_LOGE(TAG, "hid_report_map malloc failed");
@@ -361,8 +366,6 @@ esp_hid_report_map_t *esp_hid_parse_report_map(const uint8_t *hid_rm, size_t hid
return NULL;
}
temp_hid_report_map_t *map = s_temp_hid_report_map;
esp_hid_report_item_t *reports = (esp_hid_report_item_t *)calloc(1, map->reports_len * sizeof(esp_hid_report_item_t));
if (reports == NULL) {
ESP_LOGE(TAG, "hid_report_items malloc failed! %u maps", map->reports_len);