Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jun 2019 08:50: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-11@freebsd.org
Subject:   svn commit: r348893 - stable/11/lib/libusb
Message-ID:  <201906110850.x5B8oQLJ036198@repo.freebsd.org>

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

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
  Approved by:	re (kib)

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

Modified: stable/11/lib/libusb/libusb20.c
==============================================================================
--- stable/11/lib/libusb/libusb20.c	Tue Jun 11 03:40:25 2019	(r348892)
+++ stable/11/lib/libusb/libusb20.c	Tue Jun 11 08:50:26 2019	(r348893)
@@ -953,6 +953,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?201906110850.x5B8oQLJ036198>