get ready for a 1.0.1 release
[fw/altos] / ao-tools / lib / cc-usbdev.c
index ed39c0628c955deb5c1d28bd528ad842e5590745..a19e231c9fe724cd4b473d6f7ca3c6037acdd850 100644 (file)
@@ -223,7 +223,7 @@ cc_usbdevs_scan(void)
                if (dev->idVendor == 0xfffe && dev->tty) {
                        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;
@@ -258,7 +258,7 @@ match_dev(char *product, int serial)
                return NULL;
        for (i = 0; i < devs->ndev; i++) {
                dev = devs->dev[i];
-               if (product && strcmp (product, dev->product) != 0)
+               if (product && strncmp (product, dev->product, strlen(product)) != 0)
                        continue;
                if (serial && serial != dev->serial)
                        continue;