aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Thompson <thompsa@FreeBSD.org>2009-10-23 12:02:01 +0000
committerAndrew Thompson <thompsa@FreeBSD.org>2009-10-23 12:02:01 +0000
commitde411f4cd2b28c94938e2548d6a28ec8785856f1 (patch)
tree0b5e1777d6012f8f4ef6331e5799688285fcd4fa
parentdbd4bfe3179659737a9ba77ed9eae5331d810229 (diff)
downloadsrc-de411f4cd2b28c94938e2548d6a28ec8785856f1.tar.gz
src-de411f4cd2b28c94938e2548d6a28ec8785856f1.zip
MFC r198376
Prevent wraparound of the timeout variable. Submitted by: HPS Approved by: re (kib)
Notes
Notes: svn path=/stable/8/; revision=198386
-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;