From ebe829c4b9d756d7f8a137ea64839e75a21ffa75 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 31 Aug 2016 13:24:38 -0600 Subject: [PATCH] USB host composite: A test should be <= not just < --- drivers/usbhost/usbhost_composite.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usbhost/usbhost_composite.c b/drivers/usbhost/usbhost_composite.c index 67a2c42426..6e372cb686 100644 --- a/drivers/usbhost/usbhost_composite.c +++ b/drivers/usbhost/usbhost_composite.c @@ -560,7 +560,7 @@ int usbhost_composite(FAR struct usbhost_hubport_s *hport, desc = (FAR struct usb_desc_s *)&configdesc[offset]; int len = desc->len; - if (offset + len < desclen) + if (offset + len <= desclen) { /* Is this an interface descriptor? */ @@ -673,7 +673,7 @@ int usbhost_composite(FAR struct usbhost_hubport_s *hport, desc = (FAR struct usb_desc_s *)&configdesc[offset]; int len = desc->len; - if (offset + len < desclen) + if (offset + len <= desclen) { /* Is this an interface descriptor? */ @@ -750,7 +750,7 @@ int usbhost_composite(FAR struct usbhost_hubport_s *hport, cfgbuffer = (FAR uint8_t *)malloc(CUSTOM_CONFIG_BUFSIZE); if (cfgbuffer == NULL) { - uerr("ERROR: Failed to allocated configuration buffer"); + uerr("ERROR: Failed to allocate configuration buffer"); ret = -ENOMEM; goto errout_with_members; }