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.

This commit is contained in:
Adam Porter 2019-06-22 07:27:15 -06:00 committed by Gregory Nutt
parent d0c569d7b5
commit 3505cce201
2 changed files with 1 additions and 25 deletions

View File

@ -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;

View File

@ -42,30 +42,6 @@
#include <stdlib.h>
#include <pthread.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Type Declarations
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/