Only memcopy *transferred data in usbutils if we have received only success or a non-fatal error.
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;