From 3505cce2014f79ec6d7151481bfb8356a94dffa2 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sat, 22 Jun 2019 07:27:15 -0600 Subject: [PATCH] drivers/usbhost/usbhost_composite.c: The cfgdesc pointer was initialized after the buffer had been advanced, so it was not pointing where it should. The totallen operations at the end of the function ended up overwriting memory belonging to the first copied interface descriptor. --- drivers/usbhost/usbhost_composite.c | 2 +- libs/libc/stdlib/lib_abort.c | 24 ------------------------ 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/drivers/usbhost/usbhost_composite.c b/drivers/usbhost/usbhost_composite.c index cdebdec4d43..56657dc4ea7 100644 --- a/drivers/usbhost/usbhost_composite.c +++ b/drivers/usbhost/usbhost_composite.c @@ -458,13 +458,13 @@ static int usbhost_createconfig(FAR struct usbhost_member_s *member, } memcpy(buffer, configdesc, USB_SIZEOF_CFGDESC); + cfgdesc = (FAR struct usb_cfgdesc_s *)buffer; cfgsize = USB_SIZEOF_CFGDESC; buffer += USB_SIZEOF_CFGDESC; buflen -= USB_SIZEOF_CFGDESC; /* Modify the copied configuration descriptor */ - cfgdesc = (FAR struct usb_cfgdesc_s *)buffer; cfgdesc->len = USB_SIZEOF_CFGDESC; cfgdesc->ninterfaces = member->nifs; diff --git a/libs/libc/stdlib/lib_abort.c b/libs/libc/stdlib/lib_abort.c index 89db287f77f..493e174bab3 100644 --- a/libs/libc/stdlib/lib_abort.c +++ b/libs/libc/stdlib/lib_abort.c @@ -42,30 +42,6 @@ #include #include -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Type Declarations - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/