From a9cd54f24d566062a461d27f615365f41a3d11e8 Mon Sep 17 00:00:00 2001 From: Matthias Bolte Date: Tue, 1 Oct 2013 14:10:48 +0200 Subject: [PATCH] Windows: Avoid potential mismatch in transfer error reporting The default case in windows_transfer_callback() calls windows_error_str(0) which will convert the error code returned by GetLastError() to a string. This currently works because windows_transfer_callback() is either called with io_result set to NO_ERROR or io_result set to GetLastError(). If windows_transfer_callback() will ever be called with io_result set differently then the default case might report the wrong error message. Call windows_error_str(io_result) instead to avoid this. Closes #151 --- libusb/os/windows_usb.c | 2 +- libusb/version_nano.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index fdc60c7..4493088 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -2078,7 +2078,7 @@ static void windows_transfer_callback(struct usbi_transfer *itransfer, uint32_t } break; default: - usbi_err(ITRANSFER_CTX(itransfer), "detected I/O error %d: %s", io_result, windows_error_str(0)); + usbi_err(ITRANSFER_CTX(itransfer), "detected I/O error %d: %s", io_result, windows_error_str(io_result)); status = LIBUSB_TRANSFER_ERROR; break; } diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 7d39e3e..d3d70cf 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 10844 +#define LIBUSB_NANO 10845 -- 2.7.4