[systemd-devel] [PATCH] nspawn: Fix erroneous OOM when building group list

Philip Lorenz philip at bithub.de
Wed Apr 9 10:08:45 PDT 2014


change_uid_gid() never initialises sz which may cause greedy_realloc to
skip the initial buffer allocation.
---
 src/nspawn/nspawn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 84724d5..0bd52da 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -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;
-- 
1.9.1



More information about the systemd-devel mailing list