summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2018-10-12 14:26:01 +0200
committerGravatar Nikias Bassen2018-10-12 14:26:01 +0200
commit1cc8b343a4bc9320758c78e187b13bb3c9029f12 (patch)
tree9471ec444ef3ad12dc9221a5ba1d536513f88db2
parentf838cf6dc212c779562984e8a16a4cedfc1d6daf (diff)
downloadusbmuxd-1cc8b343a4bc9320758c78e187b13bb3c9029f12.tar.gz
usbmuxd-1cc8b343a4bc9320758c78e187b13bb3c9029f12.tar.bz2
usb: Fix adding hyphen to new style UDIDs by not counting '\0' towards string length
-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];
}