]> sigrok.org Git - libsigrok.git/commitdiff
fx2lafw: Replace obsoleted strncmp() calls.
authorUwe Hermann <redacted>
Wed, 18 Mar 2015 22:08:26 +0000 (23:08 +0100)
committerUwe Hermann <redacted>
Thu, 19 Mar 2015 17:25:55 +0000 (18:25 +0100)
The fixed lengths for strncmp() can no longer be used since strings of
various lengths can be passed to match_manuf_prod(). Use strcmp() instead.

src/hardware/fx2lafw/protocol.c

index bd0d4fb89e69e2ce1b6ab464a5c1cc18d087d2b0..fae80b72171df38fa02e30325a2841f856ef98e7 100644 (file)
@@ -163,13 +163,13 @@ SR_PRIV gboolean match_manuf_prod(libusb_device *dev, const char *manufacturer,
                if (libusb_get_string_descriptor_ascii(hdl,
                                des.iManufacturer, strdesc, sizeof(strdesc)) < 0)
                        break;
-               if (strncmp((const char *)strdesc, manufacturer, 6))
+               if (strcmp((const char *)strdesc, manufacturer))
                        break;
 
                if (libusb_get_string_descriptor_ascii(hdl,
                                des.iProduct, strdesc, sizeof(strdesc)) < 0)
                        break;
-               if (strncmp((const char *)strdesc, product, 7))
+               if (strcmp((const char *)strdesc, product))
                        break;
 
                ret = TRUE;