From 2e4c19f779ce48faaf5abcaa186def74956a6981 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Mon, 1 Aug 2005 05:36:50 +0000 Subject: 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@ --- sys/dev/usb/uhub.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sys/dev/usb/uhub.c') diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c index 04c10cdec78..6371b22b6d6 100644 --- a/sys/dev/usb/uhub.c +++ b/sys/dev/usb/uhub.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhub.c,v 1.31 2005/03/28 02:34:16 dlg Exp $ */ +/* $OpenBSD: uhub.c,v 1.32 2005/08/01 05:36:48 brad Exp $ */ /* $NetBSD: uhub.c,v 1.64 2003/02/08 03:32:51 ichiro Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */ @@ -153,7 +153,7 @@ USB_ATTACH(uhub) { USB_ATTACH_START(uhub, sc, uaa); usbd_device_handle dev = uaa->device; - char devinfo[1024]; + char *devinfop; usbd_status err; struct usbd_hub *hub = NULL; usb_device_request_t req; @@ -165,9 +165,11 @@ USB_ATTACH(uhub) DPRINTFN(1,("uhub_attach\n")); sc->sc_hub = dev; - usbd_devinfo(dev, 1, devinfo, sizeof devinfo); + + devinfop = usbd_devinfo_alloc(dev, 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); err = usbd_set_config_index(dev, 0, 1); if (err) { -- cgit v1.2.3