Commit bacd90082e3c3235e74cd6639573d924c1c44287

Con Kolivas 2014-02-22T15:39:00

Only memcopy *transferred data in usbutils if we have received only success or a non-fatal error.

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