Date: Tue, 11 Jun 2019 08:52:48 +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-12@freebsd.org Subject: svn commit: r348894 - stable/12/lib/libusb Message-ID: <201906110852.x5B8qm9R041348@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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.kurosawa@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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906110852.x5B8qm9R041348>