diff options
author | thompsa <thompsa@FreeBSD.org> | 2009-10-22 21:01:41 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2009-10-22 21:01:41 +0000 |
commit | 99b8f7ec7d5e07959f1c6d186336c279cfb15e80 (patch) | |
tree | d7cf11d94820031b1e9db476a0a127d4130a46de /lib | |
parent | aea2f51e44e9ddb58769a6c84402aadd14c3b227 (diff) | |
download | FreeBSD-src-99b8f7ec7d5e07959f1c6d186336c279cfb15e80.zip FreeBSD-src-99b8f7ec7d5e07959f1c6d186336c279cfb15e80.tar.gz |
Prevent wraparound of the timeout variable.
Submitted by: HPS
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libusb/libusb20_ugen20.c | 6 |
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; |