From 1cc8b343a4bc9320758c78e187b13bb3c9029f12 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Fri, 12 Oct 2018 14:26:01 +0200 Subject: usb: Fix adding hyphen to new style UDIDs by not counting '\0' towards string length --- src/usb.c | 2 ++ 1 file changed, 2 insertions(+) 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]; } -- cgit v1.1-32-gdbae