From 99b8f7ec7d5e07959f1c6d186336c279cfb15e80 Mon Sep 17 00:00:00 2001 From: thompsa Date: Thu, 22 Oct 2009 21:01:41 +0000 Subject: Prevent wraparound of the timeout variable. Submitted by: HPS --- lib/libusb/libusb20_ugen20.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/libusb/libusb20_ugen20.c') 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; -- cgit v1.1