[Pcsclite-cvs-commit] r3197 - /trunk/PCSC/src/hotplug_libusb.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Mon Nov 10 09:18:27 UTC 2008
Author: rousseau
Date: Mon Nov 10 09:18:27 2008
New Revision: 3197
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3197
Log:
HPAddHotPluggable(): correctly handle bogus reader with corrupted
iSerialNumber.
Thanks to Ludovic LANGE for the patch.
Closes: [#311215] Fix for libusb hotplug garbage when serial number is empty
Modified:
trunk/PCSC/src/hotplug_libusb.c
Modified: trunk/PCSC/src/hotplug_libusb.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/hotplug_libusb.c?rev=3197&op=diff
==============================================================================
--- trunk/PCSC/src/hotplug_libusb.c (original)
+++ trunk/PCSC/src/hotplug_libusb.c Mon Nov 10 09:18:27 2008
@@ -507,15 +507,25 @@
usb_dev_handle *device;
char serialNumber[MAX_READERNAME];
char fullname[MAX_READERNAME];
+ int ret;
device = usb_open(dev);
- usb_get_string_simple(device, dev->descriptor.iSerialNumber,
+ ret = usb_get_string_simple(device, dev->descriptor.iSerialNumber,
serialNumber, MAX_READERNAME);
usb_close(device);
- snprintf(fullname, sizeof(fullname), "%s (%s)",
- driver->readerName, serialNumber);
- readerTracker[i].fullName = strdup(fullname);
+ if (ret < 0)
+ {
+ Log2(PCSC_LOG_ERROR, "usb_get_string_simple failed: %s",
+ usb_strerror());
+ readerTracker[i].fullName = strdup(driver->readerName);
+ }
+ else
+ {
+ snprintf(fullname, sizeof(fullname), "%s (%s)",
+ driver->readerName, serialNumber);
+ readerTracker[i].fullName = strdup(fullname);
+ }
}
else
#endif
More information about the Pcsclite-cvs-commit
mailing list