diff --git a/drivers/libusb0.c b/drivers/libusb0.c index adf098ba31..d51313ec38 100644 --- a/drivers/libusb0.c +++ b/drivers/libusb0.c @@ -377,7 +377,7 @@ static int libusb_open(usb_dev_handle **udevp, upsdebug_hex(3, "HID descriptor, method 1", buf, 9); - rdlen1 = buf[7] | (buf[8] << 8); + rdlen1 = (uint8_t)buf[7] | ((uint8_t)buf[8] << 8); } if (rdlen1 < -1) { @@ -407,7 +407,7 @@ static int libusb_open(usb_dev_handle **udevp, ) { p = (usb_ctrl_char *)&iface->extra[i]; upsdebug_hex(3, "HID descriptor, method 2", p, 9); - rdlen2 = p[7] | (p[8] << 8); + rdlen2 = (uint8_t)p[7] | ((uint8_t)p[8] << 8); break; } }