mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
d/wmr: Fix crash on invalid firmware
Don't access invalid memory on a short firmware read.
This commit is contained in:
parent
d326ff9890
commit
f33326e90b
|
@ -294,7 +294,7 @@ read_controller_config(struct wmr_controller_base *wcb)
|
|||
|
||||
// Read config block
|
||||
ret = wmr_read_fw_block(wcb, 0x02, &data, &data_size);
|
||||
if (ret < 0 || data == NULL)
|
||||
if (ret < 0 || data == NULL || data_size < 2)
|
||||
return false;
|
||||
|
||||
/* De-obfuscate the JSON config */
|
||||
|
|
Loading…
Reference in a new issue