libaltos: Mis-allocated device list in libaltos
authorKeith Packard <keithp@keithp.com>
Sun, 14 Aug 2011 01:33:07 +0000 (18:33 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 14 Aug 2011 01:44:26 +0000 (18:44 -0700)
Would overrun mis-allocated array, causing chaos.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/libaltos/libaltos.c

index 00a75de9b2ac976521f8e7c15b096ae7499a7f0a..f2c8bd8d51eec9705b91a7965835660e5f8d0cf2 100644 (file)
@@ -559,7 +559,7 @@ altos_list_start(void)
                if (USB_IS_ALTUSMETRUM(dev->idVendor, dev->idProduct)) {
                        if (devs->dev)
                                devs->dev = realloc(devs->dev,
-                                                   devs->ndev + 1 * sizeof (struct usbdev *));
+                                                   (devs->ndev + 1) * sizeof (struct usbdev *));
                        else
                                devs->dev = malloc (sizeof (struct usbdev *));
                        devs->dev[devs->ndev++] = dev;