diff options
author | Guy Harris <gharris@sonic.net> | 2020-06-02 21:44:00 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2020-06-02 21:44:00 -0700 |
commit | 24fadde0e2686491798c1d88c4a20eee5a19cadc (patch) | |
tree | abb59f191961f6c87261463774b2214cc9277d46 /pcap-usb-linux.c | |
parent | f87b39e9b6fed60e28c7df050a5dfeb2f6f22abb (diff) |
usb-linux: use EXTRACT_LE_U_2() to extract a 2-byte little-endian number.
That should squelch Coverity CID 1460484; if it's worried about uint8_t
being converted to int in an expression, this should suppress *that*.
(If not, EXTRACT_LE_U_2() needs to be tweaked to arrange that no
conversion to any signed type is done.)
Diffstat (limited to 'pcap-usb-linux.c')
-rw-r--r-- | pcap-usb-linux.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c index 4debdee1..ddab03a9 100644 --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c @@ -41,6 +41,8 @@ #include "pcap-usb-linux.h" #include "pcap/usb.h" +#include "extract.h" + #ifdef NEED_STRERROR_H #include "strerror.h" #endif @@ -562,7 +564,7 @@ probe_devices(int bus) ret = ioctl(fd, USBDEVFS_CONTROL, &ctrl); if (ret >= 0) { uint16_t wtotallength; - wtotallength = (configdesc[2]) | (configdesc[3] << 8); + wtotallength = EXTRACT_LE_U_2(&configdesc[2]); #ifdef HAVE_STRUCT_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE ctrl.wLength = wtotallength; #else |