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/if_cdce.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/if_cdce.c')
-rw-r--r-- | sys/dev/usb/if_cdce.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c index d52eefec67c..9e64e219839 100644 --- a/sys/dev/usb/if_cdce.c +++ b/sys/dev/usb/if_cdce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cdce.c,v 1.9 2005/07/02 22:21:12 brad Exp $ */ +/* $OpenBSD: if_cdce.c,v 1.10 2005/08/01 05:36:48 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com> @@ -126,7 +126,7 @@ USB_MATCH(cdce) USB_ATTACH(cdce) { USB_ATTACH_START(cdce, sc, uaa); - char devinfo[1024]; + char *devinfop; int s; struct ifnet *ifp; usbd_device_handle dev = uaa->device; @@ -138,9 +138,10 @@ USB_ATTACH(cdce) u_int16_t macaddr_hi; int i; - usbd_devinfo(dev, 0, devinfo, sizeof devinfo); + devinfop = usbd_devinfo_alloc(dev, 0); USB_ATTACH_SETUP; - printf("%s: %s\n", USBDEVNAME(sc->cdce_dev), devinfo); + printf("%s: %s\n", USBDEVNAME(sc->cdce_dev), devinfop); + usbd_devinfo_free(devinfop); sc->cdce_udev = uaa->device; sc->cdce_ctl_iface = uaa->iface; |