wacom-usb: Fix a potentially unsafe memcpy()

Spotted by Coverity.
This commit is contained in:
Richard Hughes 2021-10-27 14:12:21 +01:00
parent 128a3afaa9
commit 39e006e563

View File

@ -82,7 +82,15 @@ fu_wac_module_touch_write_firmware(FuDevice *device,
buf[1] = fu_chunk_get_idx(chk) + 1;
fu_common_write_uint32(&buf[2], fu_chunk_get_address(chk), G_LITTLE_ENDIAN);
buf[6] = 0x10; /* no idea! */
memcpy(&buf[7], fu_chunk_get_data(chk), fu_chunk_get_data_sz(chk));
if (!fu_memcpy_safe(buf,
sizeof(buf),
0x07, /* dst */
fu_chunk_get_data(chk),
fu_chunk_get_data_sz(chk),
0x0, /* src */
fu_chunk_get_data_sz(chk),
error))
return FALSE;
blob_chunk = g_bytes_new(buf, sizeof(buf));
if (!fu_wac_module_set_feature(self,
FU_WAC_MODULE_COMMAND_DATA,