From 9b58da986680a92b350f02cd31ff64f30fecd07c Mon Sep 17 00:00:00 2001 From: Bill Parker Date: Wed, 17 Jul 2013 15:30:35 -0700 Subject: Fix bug 10025 - Lack of Sanity Checking in calls to malloc()/calloc(). In reviewing various files in Samba-4.0.7, I found a number of instances where malloc()/calloc() were called without the checking the return value for a value of NULL, which would indicate failure. (NB. The changes needed to ccan, iniparser, popt and heimdal will be reported upstream, not patched inside Samba). Reviewed-by: Jeremy Allison Reviewed-by: Simo Source --- nsswitch/nsstest.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nsswitch') diff --git a/nsswitch/nsstest.c b/nsswitch/nsstest.c index 39d03424fa..4b3d0a4301 100644 --- a/nsswitch/nsstest.c +++ b/nsswitch/nsstest.c @@ -371,6 +371,10 @@ static void nss_test_initgroups(char *name, gid_t gid) NSS_STATUS status; groups = (gid_t *)malloc(sizeof(gid_t) * size); + if (groups == NULL) { + printf("Unable to allocate memory for groups\n"); + return; + } groups[0] = gid; status = nss_initgroups(name, gid, &groups, &start, &size); -- cgit