summaryrefslogtreecommitdiff
path: root/sys/dev/usb/uipaq.c
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2005-08-01 05:36:50 +0000
committerBrad Smith <brad@cvs.openbsd.org>2005-08-01 05:36:50 +0000
commit2e4c19f779ce48faaf5abcaa186def74956a6981 (patch)
tree2a7d441b21de326c5a27b994bce0b47dcb3dd0e7 /sys/dev/usb/uipaq.c
parent0fd85d9caed3489931a1fa9c2b7520960293653d (diff)
Don't keep the devinfo string on the stack, instead use malloc/free.
This should cure some rare stack overflows. From augustss NetBSD ok dlg@ pascoe@
Diffstat (limited to 'sys/dev/usb/uipaq.c')
-rw-r--r--sys/dev/usb/uipaq.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/usb/uipaq.c b/sys/dev/usb/uipaq.c
index ed97f8c1be1..b7617ade5f2 100644
--- a/sys/dev/usb/uipaq.c
+++ b/sys/dev/usb/uipaq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipaq.c,v 1.1 2005/06/17 23:50:33 deraadt Exp $ */
+/* $OpenBSD: uipaq.c,v 1.2 2005/08/01 05:36:48 brad Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -152,7 +152,7 @@ USB_ATTACH(uipaq)
usbd_interface_handle iface;
usb_interface_descriptor_t *id;
usb_endpoint_descriptor_t *ed;
- char devinfo[1024];
+ char *devinfop;
char *devname = USBDEVNAME(sc->sc_dev);
int i;
usbd_status err;
@@ -175,9 +175,10 @@ USB_ATTACH(uipaq)
goto bad;
}
- usbd_devinfo(dev, 0, devinfo, sizeof devinfo);
+ devinfop = usbd_devinfo_alloc(dev, 0);
USB_ATTACH_SETUP;
- printf("%s: %s\n", devname, devinfo);
+ printf("%s: %s\n", devname, devinfop);
+ usbd_devinfo_free(devinfop);
sc->sc_flags = uipaq_lookup(uaa->vendor, uaa->product)->uv_flags;