From 80cde5b0b5008200d6020d9a55b74260245a4e3b Mon Sep 17 00:00:00 2001 From: hathach Date: Sun, 1 Sep 2019 17:20:10 +0700 Subject: [PATCH] fix potential bug with mis-align issue --- src/class/hid/hid_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/class/hid/hid_device.c b/src/class/hid/hid_device.c index 949fd183..572f2cad 100644 --- a/src/class/hid/hid_device.c +++ b/src/class/hid/hid_device.c @@ -178,7 +178,7 @@ bool hidd_open(uint8_t rhport, tusb_desc_interface_t const * desc_itf, uint16_t p_hid->boot_mode = false; // default mode is REPORT p_hid->itf_num = desc_itf->bInterfaceNumber; - p_hid->reprot_desc_len = desc_hid->wReportLength; + memcpy(&p_hid->reprot_desc_len, &desc_hid->wReportLength, 2); *p_len = sizeof(tusb_desc_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + desc_itf->bNumEndpoints*sizeof(tusb_desc_endpoint_t);