diff options
author | Pete Batard <pete@akeo.ie> | 2012-03-30 13:40:32 +0100 |
---|---|---|
committer | Pete Batard <pete@akeo.ie> | 2012-03-31 00:35:46 +0100 |
commit | 5a4d7cf08d80d56e3eb2cf2cd9f4f7b29588fa24 (patch) | |
tree | 8ca452cb7b2b11307d0cf0bbd5f074ec11757f65 | |
parent | c581017c2c09ee7f367b00a95387725344785f1a (diff) | |
download | libusb-5a4d7cf08d80d56e3eb2cf2cd9f4f7b29588fa24.tar.gz |
Darwin: Fix a warning on 64 bit platforms
-rw-r--r-- | libusb/os/darwin_usb.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c index e112cf5..60d2e03 100644 --- a/libusb/os/darwin_usb.c +++ b/libusb/os/darwin_usb.c @@ -1547,7 +1547,11 @@ static void darwin_async_io_callback (void *refcon, IOReturn result, void *arg0) usbi_info (ITRANSFER_CTX (itransfer), "an async io operation has completed"); - size = (UInt32) arg0; + /* The size should never be larger than 4 GB - Also see libusb bug #117 */ + if ((intptr_t) arg0 > UINT32_MAX) + usbi_err (ITRANSFER_CTX (itransfer), + "async size truncation detected - please report this error"); + size = (UInt32) (intptr_t) arg0; /* send a completion message to the device's file descriptor */ message = MESSAGE_ASYNC_IO_COMPLETE; |