[PATCH spice-gtk 6/6] channel: don't call memcpy with NULL dest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

If ncaps == 0, the array will be NULL after set_size().

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
 src/spice-channel.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/spice-channel.c b/src/spice-channel.c
index 642e829..b6141cd 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -1891,6 +1891,9 @@ static void store_caps(const uint8_t *caps_src, uint32_t ncaps,
     guint i;
 
     g_array_set_size(caps_dst, ncaps);
+    if (ncaps == 0)
+        return;
+
     caps = &g_array_index(caps_dst, uint32_t, 0);
     memcpy(caps, caps_src, ncaps * sizeof(uint32_t));
 
-- 
2.14.0.1.geff633fa0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]