projects
/
users
/
dwmw2
/
qemu.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
981780c
)
hw/xen: Check if len is 0 before memcpy()
pull-xenfv-20250109-1
author
Akihiko Odaki <akihiko.odaki@daynix.com>
Wed, 8 Jan 2025 11:31:46 +0000
(20:31 +0900)
committer
David Woodhouse <dwmw@amazon.co.uk>
Thu, 9 Jan 2025 10:43:13 +0000
(10:43 +0000)
data->data can be NULL when len is 0. Strictly speaking, the behavior
of memcpy() in such a scenario is undefined so UBSan complaints.
Satisfy UBSan by checking if len is 0 before memcpy().
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
hw/i386/kvm/xen_xenstore.c
patch
|
blob
|
history
diff --git
a/hw/i386/kvm/xen_xenstore.c
b/hw/i386/kvm/xen_xenstore.c
index 59691056670e241cf547533a619ce2a6a1fe3070..17802aa33d201edd249cadcd476b7efb395bc080 100644
(file)
--- a/
hw/i386/kvm/xen_xenstore.c
+++ b/
hw/i386/kvm/xen_xenstore.c
@@
-532,6
+532,10
@@
static void xs_read(XenXenstoreState *s, unsigned int req_id,
return;
}
+ if (!len) {
+ return;
+ }
+
memcpy(&rsp_data[rsp->len], data->data, len);
rsp->len += len;
}