Commit 91bd04e84bd6fb75f43ddeb3a4d82c541ba1707e

Con Kolivas 2014-02-01T10:55:10

Do not memcpy in usbutils unless data was transferred.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/usbutils.c b/usbutils.c
index 765a336..e123dce 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -2592,7 +2592,7 @@ err_retry:
 	}
 	if (err == LIBUSB_ERROR_IO && ++err_retries < USB_RETRY_MAX)
 		goto err_retry;
-	if ((endpoint & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_IN)
+	if (*transferred && (endpoint & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_IN)
 		memcpy(data, buf, *transferred);
 
 	return err;