diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2005-08-01 05:36:50 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2005-08-01 05:36:50 +0000 |
commit | 2e4c19f779ce48faaf5abcaa186def74956a6981 (patch) | |
tree | 2a7d441b21de326c5a27b994bce0b47dcb3dd0e7 /sys/dev/usb/umass.c | |
parent | 0fd85d9caed3489931a1fa9c2b7520960293653d (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/umass.c')
-rw-r--r-- | sys/dev/usb/umass.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index 6dff4f0b197..5c22a5bac58 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass.c,v 1.42 2005/05/24 04:51:04 pascoe Exp $ */ +/* $OpenBSD: umass.c,v 1.43 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: umass.c,v 1.116 2004/06/30 05:53:46 mycroft Exp $ */ /* @@ -304,12 +304,14 @@ USB_ATTACH(umass) usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; const char *sWire, *sCommand; - char devinfo[1024]; + char *devinfop; usbd_status err; int i, bno, error; - 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), devinfop); + usbd_devinfo_free(devinfop); sc->sc_udev = uaa->device; sc->sc_iface = uaa->iface; @@ -381,8 +383,6 @@ USB_ATTACH(umass) } } - printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); - switch (sc->sc_wire) { case UMASS_WPROTO_CBI: sWire = "CBI"; |