summaryrefslogtreecommitdiffstats
path: root/sys/compat/ndis
diff options
context:
space:
mode:
authorweongyo <weongyo@FreeBSD.org>2009-03-16 11:19:07 +0000
committerweongyo <weongyo@FreeBSD.org>2009-03-16 11:19:07 +0000
commitbde9ac2d70cf820ca3229a28ede0344d1256228b (patch)
tree671277bcbebffb5f3d88d5046b4ecfe1b1627b66 /sys/compat/ndis
parent8c380f22c829c38b8c194ea664399a44109e5ef6 (diff)
downloadFreeBSD-src-bde9ac2d70cf820ca3229a28ede0344d1256228b.zip
FreeBSD-src-bde9ac2d70cf820ca3229a28ede0344d1256228b.tar.gz
use usb2_desc_foreach() to iterate the USB config descriptor instread of
accessing structures directly to check some invalid descriptors. Pointed by: hps
Diffstat (limited to 'sys/compat/ndis')
-rw-r--r--sys/compat/ndis/subr_usbd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/compat/ndis/subr_usbd.c b/sys/compat/ndis/subr_usbd.c
index a07e2cc..83e379c 100644
--- a/sys/compat/ndis/subr_usbd.c
+++ b/sys/compat/ndis/subr_usbd.c
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_process.h>
#include <dev/usb/usb_device.h>
#include <dev/usb/usb_error.h>
+#include <dev/usb/usb_parse.h>
#include <dev/usb/usb_request.h>
#include <compat/ndis/pe_var.h>
@@ -1206,12 +1207,11 @@ USBD_ParseConfigurationDescriptorEx(conf, start, intfnum,
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))
OpenPOWER on IntegriCloud