Author: hselasky
Date: Tue Jun 11 08:52:48 2019
New Revision: 348894
URL: https://svnweb.freebsd.org/changeset/base/348894

Log:
  MFC r348797:
  Fix for reading the configuration descriptor in libusb. Catch invalid
  configuration descriptor reads early on to avoid issues with devices
  that don't check for a valid USB configuration read request.
  
  Submitted by: takahiro.kuros...@gmail.com
  PR:           238412

Modified:
  stable/12/lib/libusb/libusb20.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libusb/libusb20.c
==============================================================================
--- stable/12/lib/libusb/libusb20.c     Tue Jun 11 08:50:26 2019        
(r348893)
+++ stable/12/lib/libusb/libusb20.c     Tue Jun 11 08:52:48 2019        
(r348894)
@@ -955,6 +955,14 @@ libusb20_dev_alloc_config(struct libusb20_device *pdev
        uint8_t do_close;
        int error;
 
+       /*
+        * Catch invalid configuration descriptor reads early on to
+        * avoid issues with devices that don't check for a valid USB
+        * configuration read request.
+        */
+       if (configIndex >= pdev->ddesc.bNumConfigurations)
+               return (NULL);
+
        if (!pdev->is_opened) {
                error = libusb20_dev_open(pdev, 0);
                if (error) {
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to