aboutsummaryrefslogtreecommitdiff
path: root/disas/hppa.c
diff options
context:
space:
mode:
authorFabiano Rosas <farosas@suse.de>2024-09-19 12:06:11 -0300
committerPeter Xu <peterx@redhat.com>2024-10-08 15:28:55 -0400
commit68e0fca625912c7c63a8bfbc784f53d4fefa1a13 (patch)
tree51f2192f79448ca039d11e214997ebe4c3723373 /disas/hppa.c
parent8d3031fa1bfcdc623934ec7b15889a3f49248552 (diff)
downloadqemu-68e0fca625912c7c63a8bfbc784f53d4fefa1a13.zip
qemu-68e0fca625912c7c63a8bfbc784f53d4fefa1a13.tar.gz
qemu-68e0fca625912c7c63a8bfbc784f53d4fefa1a13.tar.bz2
migration/multifd: Ensure packet->ramblock is null-terminated
Coverity points out that the current usage of strncpy to write the ramblock name allows the field to not have an ending '\0' in case idstr is already not null-terminated (e.g. if it's larger than 256 bytes). This is currently harmless because the packet->ramblock field is never touched again on the source side. The destination side reads only up to the field's size from the stream and forces the last byte to be 0. We're still open to a programming error in the future in case this field is ever passed into a function that expects a null-terminated string. Change from strncpy to QEMU's pstrcpy, which puts a '\0' at the end of the string and doesn't fill the extra space with zeros. (there's no spillage between iterations of fill_packet because after commit 87bb9e953e ("migration/multifd: Isolate ram pages packet data") the packet is always zeroed before filling) Resolves: Coverity CID 1560071 Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20240919150611.17074-1-farosas@suse.de Signed-off-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'disas/hppa.c')
0 files changed, 0 insertions, 0 deletions