From 171b36e766d36e647c3f7531e8460bb26dab105e Mon Sep 17 00:00:00 2001 From: CCHhui <34808897+CutClassH@users.noreply.github.com> Date: Mon, 16 Sep 2024 22:35:46 +0800 Subject: [PATCH] fix(core/usbh_core): Fix raw_config_desc heap out of bounds --- core/usbh_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/usbh_core.c b/core/usbh_core.c index cbdaecb..2429b98 100644 --- a/core/usbh_core.c +++ b/core/usbh_core.c @@ -486,7 +486,7 @@ int usbh_enumerate(struct usbh_hubport *hport) goto errout; } USB_LOG_INFO("The device has %d interfaces\r\n", ((struct usb_configuration_descriptor *)ep0_request_buffer[hport->bus->busid])->bNumInterfaces); - hport->raw_config_desc = usb_osal_malloc(wTotalLength); + hport->raw_config_desc = usb_osal_malloc(wTotalLength + 1); if (hport->raw_config_desc == NULL) { ret = -USB_ERR_NOMEM; USB_LOG_ERR("No memory to alloc for raw_config_desc\r\n");