chiark / gitweb /
sd-device: fix device_get_properties_strv()
authorTom Gundersen <teg@jklm.no>
Wed, 27 May 2015 21:26:39 +0000 (23:26 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:01:12 +0000 (10:01 +0100)
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/libelogind/sd-device/device-private.c

index 3cadedbf4a6e513ee106b7988e865c2ff23489ae..10370af029b5262b20f393dd8b7f402b0c10ff16 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;
         }