A struct with a trailing zero-length array (for variable-length data) is
treated as a zero-sized object when doing pointer arithmetic, but treated
correctly when treated as an array. This generates a warning from gcc-10
load->data + address - load->address
while this, which is 'the same', does not:
&load->data[address - load->address]
Signed-off-by: Keith Packard <keithp@keithp.com>
if (address < load->address || load->address + load->length < address + length)
return false;
- memcpy(load->data + address - load->address, data, length);
+ memcpy(&load->data[address - load->address], data, length);
return true;
}