Skip to content

Commit b5dfb25

Browse files
committed
usb: Make sure buffer for vendor specific request is 0-initialized
1 parent c7a0dd9 commit b5dfb25

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/usb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ static int submit_vendor_specific(struct libusb_device_handle *handle, struct mo
369369
{
370370
struct libusb_transfer* ctrl_transfer = libusb_alloc_transfer(0);
371371
int ret = 0;
372-
unsigned char* buffer = malloc(LIBUSB_CONTROL_SETUP_SIZE + context->wLength);
372+
unsigned char* buffer = calloc(LIBUSB_CONTROL_SETUP_SIZE + context->wLength, 1);
373373
uint8_t bRequestType = LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN | LIBUSB_RECIPIENT_DEVICE;
374374
libusb_fill_control_setup(buffer, bRequestType, context->bRequest, context->wValue, context->wIndex, context->wLength);
375375

0 commit comments

Comments
 (0)