diff options
author | 2005-08-01 05:36:47 +0000 | |
---|---|---|
committer | 2005-08-01 05:36:47 +0000 | |
commit | 71a5dfcea878f0a686cfcb96b61515f5a2c45769 (patch) | |
tree | 53b51b8cc6ff82c6607bfc36860b71952e187ab7 /sys/dev/usb/ugen.c | |
parent | expose arc4random_bytes() API; ok deraadt@ (diff) | |
download | wireguard-openbsd-71a5dfcea878f0a686cfcb96b61515f5a2c45769.tar.xz wireguard-openbsd-71a5dfcea878f0a686cfcb96b61515f5a2c45769.zip |
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/ugen.c')
-rw-r--r-- | sys/dev/usb/ugen.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 777c2916cdd..e62083e9dd2 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugen.c,v 1.31 2004/10/31 12:10:52 dlg Exp $ */ +/* $OpenBSD: ugen.c,v 1.32 2005/08/01 05:36:48 brad Exp $ */ /* $NetBSD: ugen.c,v 1.63 2002/11/26 18:49:48 christos Exp $ */ /* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -199,13 +199,14 @@ USB_ATTACH(ugen) { USB_ATTACH_START(ugen, sc, uaa); usbd_device_handle udev; - char devinfo[1024]; + char *devinfop; usbd_status err; int conf; - usbd_devinfo(uaa->device, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(uaa->device, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); sc->sc_udev = udev = uaa->device; |