From: Marc-André Lureau <marcandre.lur...@redhat.com>

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

Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>
---
 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to