summaryrefslogtreecommitdiffstats
path: root/lib/libusb/libusb20_ugen20.c
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2009-10-22 21:01:41 +0000
committerthompsa <thompsa@FreeBSD.org>2009-10-22 21:01:41 +0000
commit99b8f7ec7d5e07959f1c6d186336c279cfb15e80 (patch)
treed7cf11d94820031b1e9db476a0a127d4130a46de /lib/libusb/libusb20_ugen20.c
parentaea2f51e44e9ddb58769a6c84402aadd14c3b227 (diff)
downloadFreeBSD-src-99b8f7ec7d5e07959f1c6d186336c279cfb15e80.zip
FreeBSD-src-99b8f7ec7d5e07959f1c6d186336c279cfb15e80.tar.gz
Prevent wraparound of the timeout variable.
Submitted by: HPS
Diffstat (limited to 'lib/libusb/libusb20_ugen20.c')
-rw-r--r--lib/libusb/libusb20_ugen20.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libusb/libusb20_ugen20.c b/lib/libusb/libusb20_ugen20.c
index 0dee793..f9f3689 100644
--- a/lib/libusb/libusb20_ugen20.c
+++ b/lib/libusb/libusb20_ugen20.c
@@ -800,7 +800,11 @@ ugen20_tr_submit(struct libusb20_transfer *xfer)
if (xfer->flags & LIBUSB20_TRANSFER_DO_CLEAR_STALL) {
fsep->flags |= USB_FS_FLAG_CLEAR_STALL;
}
- fsep->timeout = xfer->timeout;
+ /* NOTE: The "fsep->timeout" variable is 16-bit. */
+ if (xfer->timeout > 65535)
+ fsep->timeout = 65535;
+ else
+ fsep->timeout = xfer->timeout;
temp.ep_index = xfer->trIndex;
OpenPOWER on IntegriCloud