sd-device: fix device_get_properties_strv()
authorTom Gundersen <teg@jklm.no>
Wed, 27 May 2015 21:26:39 +0000 (23:26 +0200)
committerTom Gundersen <teg@jklm.no>
Wed, 27 May 2015 21:30:02 +0000 (23:30 +0200)
A NULL pointer was inserted as the first element of the strv.

This had the effect of always passing the empty environment to processes
spawned by udev.

Reported by MichaƂ Bartoszkiewicz.

src/libsystemd/sd-device/device-private.c

index 3cadedb..10370af 100644 (file)
@@ -659,7 +659,7 @@ static int device_update_properties_bufs(sd_device *device) {
                 if (!buf_strv)
                         return -ENOMEM;
 
-                buf_strv[++ strv_size] = (char *)&buf_nulstr[nulstr_len];
+                buf_strv[strv_size ++] = (char *)&buf_nulstr[nulstr_len];
                 strscpyl((char *)buf_nulstr + nulstr_len, len + 1, prop, "=", val, NULL);
                 nulstr_len += len + 1;
         }