chiark / gitweb /
nspawn: Fix erroneous OOM when building group list
authorPhilip Lorenz <philip@bithub.de>
Wed, 9 Apr 2014 17:08:45 +0000 (19:08 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 10 Apr 2014 13:50:39 +0000 (09:50 -0400)
change_uid_gid() never initialises sz which may cause greedy_realloc to
skip the initial buffer allocation.

src/nspawn/nspawn.c

index 84724d59c9177cae9a16acafb70c4c24f8340525..0bd52da56843df40b31cd6227f4a6747491b6c8c 100644 (file)
@@ -2366,7 +2366,7 @@ static int change_uid_gid(char **_home) {
         _cleanup_fclose_ FILE *f = NULL;
         _cleanup_close_ int fd = -1;
         unsigned n_uids = 0;
-        size_t sz, l;
+        size_t sz = 0, l;
         uid_t uid;
         gid_t gid;
         pid_t pid;