From: Andrew Bartlett Date: Mon, 20 Feb 2012 02:46:29 +0000 (+1100) Subject: nsstest: Allocate the correct sized buffer for initgroups X-Git-Tag: samba-4.0.0alpha18~67 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f260596206882a085fd43e5204acaecde72c3bab;p=thirdparty%2Fsamba.git nsstest: Allocate the correct sized buffer for initgroups Found by chance due to a re-order of the tests to start s3member earlier and chasing down a malloc Abort into a valgrind error. Only happens when a user has more than 4 groups. Andrew Bartlett Autobuild-User: Andrew Bartlett Autobuild-Date: Mon Feb 20 05:23:04 CET 2012 on sn-devel-104 --- diff --git a/nsswitch/nsstest.c b/nsswitch/nsstest.c index d84e028513b..e2b39bc6bea 100644 --- a/nsswitch/nsstest.c +++ b/nsswitch/nsstest.c @@ -370,7 +370,7 @@ static void nss_test_initgroups(char *name, gid_t gid) int i; NSS_STATUS status; - groups = (gid_t *)malloc(size); + groups = (gid_t *)malloc(sizeof(gid_t) * size); groups[0] = gid; status = nss_initgroups(name, gid, &groups, &start, &size);