From b5dfb25dd464527e68b78daffe34766a1ed7b281 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Fri, 29 Sep 2023 11:42:35 +0200 Subject: usb: Make sure buffer for vendor specific request is 0-initialized --- src/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/usb.c b/src/usb.c index dfea3dd..63d0208 100644 --- a/src/usb.c +++ b/src/usb.c @@ -369,7 +369,7 @@ static int submit_vendor_specific(struct libusb_device_handle *handle, struct mo { struct libusb_transfer* ctrl_transfer = libusb_alloc_transfer(0); int ret = 0; - unsigned char* buffer = malloc(LIBUSB_CONTROL_SETUP_SIZE + context->wLength); + unsigned char* buffer = calloc(LIBUSB_CONTROL_SETUP_SIZE + context->wLength, 1); uint8_t bRequestType = LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN | LIBUSB_RECIPIENT_DEVICE; libusb_fill_control_setup(buffer, bRequestType, context->bRequest, context->wValue, context->wIndex, context->wLength); -- cgit v1.1-32-gdbae