From owner-svn-src-all@FreeBSD.ORG Mon Mar 16 11:19:26 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 670FD10657E9; Mon, 16 Mar 2009 11:19:26 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 101858FC4E; Mon, 16 Mar 2009 11:19:08 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2GBJ71h058967; Mon, 16 Mar 2009 11:19:07 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2GBJ77p058966; Mon, 16 Mar 2009 11:19:07 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <200903161119.n2GBJ77p058966@svn.freebsd.org> From: Weongyo Jeong Date: Mon, 16 Mar 2009 11:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189874 - head/sys/compat/ndis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2009 11:20:00 -0000 Author: weongyo Date: Mon Mar 16 11:19:07 2009 New Revision: 189874 URL: http://svn.freebsd.org/changeset/base/189874 Log: use usb2_desc_foreach() to iterate the USB config descriptor instread of accessing structures directly to check some invalid descriptors. Pointed by: hps Modified: head/sys/compat/ndis/subr_usbd.c Modified: head/sys/compat/ndis/subr_usbd.c ============================================================================== --- head/sys/compat/ndis/subr_usbd.c Mon Mar 16 10:56:50 2009 (r189873) +++ head/sys/compat/ndis/subr_usbd.c Mon Mar 16 11:19:07 2009 (r189874) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1206,12 +1207,11 @@ USBD_ParseConfigurationDescriptorEx(conf int32_t intfsubclass; int32_t intfproto; { - char *pos; + struct usb2_descriptor *next = NULL; usb_interface_descriptor_t *desc; - for (pos = start; pos < ((char *)conf + UGETW(conf->wTotalLength)); - pos += desc->bLength) { - desc = (usb_interface_descriptor_t *)pos; + while ((next = usb2_desc_foreach(conf, next)) != NULL) { + desc = (usb_interface_descriptor_t *)next; if (desc->bDescriptorType != UDESC_INTERFACE) continue; if (!(intfnum == -1 || desc->bInterfaceNumber == intfnum))