]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/gshadow.c: build_list(): Fix type of parameter
authorAlejandro Colomar <alx@kernel.org>
Mon, 4 Nov 2024 16:16:33 +0000 (17:16 +0100)
committerSerge Hallyn <serge@hallyn.com>
Fri, 6 Dec 2024 03:20:59 +0000 (21:20 -0600)
commit960947135cfcb26352f2dde35fd4a3645dbaa268
tree1a07edad0db14887f0888533f62091b879a1a85f
parentc8c105938480d0e2c531049292923f1c969d1332
lib/gshadow.c: build_list(): Fix type of parameter

list ($2) is a pointer to a list of strings.  We were declaring it as an
array of pointers to strings, which was bogus.  It worked out of luck,
because array parameters are transformed into pointers by the compiler,
but it was incorrect.  Just look at how we're calling this function.

$ grep build_list lib/gshadow.c
build_list(char *s, char ***list, size_t *nlist)
sgroup.sg_adm = build_list (fields[2], &admins, &nadmins);
sgroup.sg_mem = build_list (fields[3], &members, &nmembers);
$ grep '^static .*\<admins\>' lib/gshadow.c
static /*@null@*//*@only@*/char **admins = NULL;
$ grep '^static .*\<members\>' lib/gshadow.c
static /*@null@*//*@only@*/char **members = NULL;

Fixes: 8e167d28afd6 ("[svn-upgrade] Integrating new upstream version, shadow (4.0.8)")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/gshadow.c