summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/usb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/usb.c b/src/usb.c
index 44c33ce..b659d90 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -274,6 +274,8 @@ static void get_serial_callback(struct libusb_transfer *transfer)
for (di = 0, si = 2; si < data[0] && di < sizeof(usbdev->serial)-1; si += 2) {
if ((data[si] & 0x80) || (data[si + 1])) /* non-ASCII */
usbdev->serial[di++] = '?';
+ else if (data[si] == '\0')
+ break;
else
usbdev->serial[di++] = data[si];
}