Marshall NULL strings correctly
authorKristian Høgsberg <krh@bitplanet.net>
Wed, 8 Sep 2010 02:15:22 +0000 (22:15 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 8 Sep 2010 02:15:22 +0000 (22:15 -0400)
connection.c

index 9893455..e0eee73 100644 (file)
@@ -400,7 +400,10 @@ wl_connection_vmarshal(struct wl_connection *connection,
                        length = s ? strlen(s) + 1: 0;
                        *p++ = length;
 
-                       *sp = (const char *) p;
+                       if (length > 0)
+                               *sp = (const char *) p;
+                       else
+                               *sp = NULL;
 
                        memcpy(p, s, length);
                        p += DIV_ROUNDUP(length, sizeof *p);