Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jun 2019 08:53:26 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r348895 - stable/10/lib/libusb
Message-ID:  <201906110853.x5B8rQun041451@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Tue Jun 11 08:53:26 2019
New Revision: 348895
URL: https://svnweb.freebsd.org/changeset/base/348895

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.kurosawa@gmail.com
  PR:		238412

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

Modified: stable/10/lib/libusb/libusb20.c
==============================================================================
--- stable/10/lib/libusb/libusb20.c	Tue Jun 11 08:52:48 2019	(r348894)
+++ stable/10/lib/libusb/libusb20.c	Tue Jun 11 08:53:26 2019	(r348895)
@@ -935,6 +935,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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906110853.x5B8rQun041451>