aboutsummaryrefslogtreecommitdiff
path: root/lib/libusb/libusb20_ugen20.c
diff options
context:
space:
mode:
authorAndrew Thompson <thompsa@FreeBSD.org>2009-10-22 21:01:41 +0000
committerAndrew Thompson <thompsa@FreeBSD.org>2009-10-22 21:01:41 +0000
commit0c35eaad3fbd2cefd3ae24a03cef06f51d6ace53 (patch)
treed7cf11d94820031b1e9db476a0a127d4130a46de /lib/libusb/libusb20_ugen20.c
parent62d98575012da9e7021e0e690ec4d5deb677ee51 (diff)
downloadsrc-0c35eaad3fbd2cefd3ae24a03cef06f51d6ace53.tar.gz
src-0c35eaad3fbd2cefd3ae24a03cef06f51d6ace53.zip
Prevent wraparound of the timeout variable.
Submitted by: HPS
Notes
Notes: svn path=/head/; revision=198376
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 0dee7935b7a0..f9f36891a034 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;