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/uplcom.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/uplcom.c')
-rw-r--r-- | sys/dev/usb/uplcom.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/usb/uplcom.c b/sys/dev/usb/uplcom.c index 33b0ad6f8dd..658fbd5e40f 100644 --- a/sys/dev/usb/uplcom.c +++ b/sys/dev/usb/uplcom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uplcom.c,v 1.23 2005/07/04 00:37:21 deraadt Exp $ */ +/* $OpenBSD: uplcom.c,v 1.24 2005/08/01 05:36:49 brad Exp $ */ /* $NetBSD: uplcom.c,v 1.29 2002/09/23 05:51:23 simonb Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -220,15 +220,16 @@ USB_ATTACH(uplcom) usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - char devinfo[1024]; + char *devinfop; char *devname = USBDEVNAME(sc->sc_dev); usbd_status err; int i; struct ucom_attach_args uca; - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); - USB_ATTACH_SETUP; - printf("%s: %s\n", devname, devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); + USB_ATTACH_SETUP; + printf("%s: %s\n", devname, devinfop); + usbd_devinfo_free(devinfop); sc->sc_udev = dev; |