chiark / gitweb /
machinectl: make sure we are not reading an unitialized variable
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 19 Jul 2014 01:44:58 +0000 (21:44 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 19 Jul 2014 01:44:58 +0000 (21:44 -0400)
src/machine/machinectl.c

index cc3be98..574c988 100644 (file)
@@ -376,6 +376,8 @@ static int map_netif(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_
         r = sd_bus_message_read_array(m, SD_BUS_TYPE_INT32, &v, &l);
         if (r < 0)
                 return r;
+        if (r == 0)
+                return -EBADMSG;
 
         i->n_netif = l / sizeof(int32_t);
         i->netif = memdup(v, l);