mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-05-30 13:03:23 +00:00
[Bug] XAP: Fix unaligned memory access in config blob handler and USB task loop condition (#18612)
* Fix unaligned memory access in config blob handler data* points in the middle of an u8 array, casting this to an u16* and dereferencing it leads to an unaligned memory access - which hardfaults on Cortex M0 mcus e.g. RP2040s. * Actually read until there is no more data to be read
This commit is contained in:
parent
d479eaf2d6
commit
907640e40e
@ -64,7 +64,8 @@ bool xap_respond_get_config_blob_chunk(xap_token_t token, const void *data, size
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t offset = *((uint16_t *)data);
|
||||
uint16_t offset;
|
||||
memcpy(&offset, data, sizeof(uint16_t));
|
||||
|
||||
xap_route_qmk_config_blob_chunk_t ret = {0};
|
||||
|
||||
|
@ -1165,7 +1165,7 @@ void xap_task(void) {
|
||||
uint8_t buffer[XAP_EPSIZE];
|
||||
size_t size = 0;
|
||||
do {
|
||||
size_t size = chnReadTimeout(&drivers.xap_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
|
||||
size = chnReadTimeout(&drivers.xap_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
|
||||
if (size > 0) {
|
||||
xap_receive_base(buffer);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user