From cb39645e9a9bb352c1c9cb8f82f01c541a9328f4 Mon Sep 17 00:00:00 2001
From: Arthur de Jong <arthur@arthurdejong.org>
Date: Sat, 8 Sep 2012 13:09:38 +0000
Subject: fix possible NULL pointer dereference (r1591 from 0.8, r1730 from
 0.7)

git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd-0.7.15+squeeze@1752 ef36b2f9-881f-0410-afb5-c4e39611909c
---
 nslcd/netgroup.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/nslcd/netgroup.c b/nslcd/netgroup.c
index 298b1ab..ee912a3 100644
--- a/nslcd/netgroup.c
+++ b/nslcd/netgroup.c
@@ -209,6 +209,12 @@ static int write_netgroup(TFILE *fp,MYLDAP_ENTRY *entry, const char *reqname)
   const char **members;
   /* get the netgroup name */
   names=myldap_get_values(entry,attmap_netgroup_cn);
+  if ((names==NULL)||(names[0]==NULL))
+  {
+    log_log(LOG_WARNING,"%s: %s: missing",
+                        myldap_get_dn(entry),attmap_netgroup_cn);
+    return 0;
+  }
   for (i=0;(names[i]!=NULL)&&(strcmp(reqname,names[i])!=0);i++)
     /* nothing here */ ;
   if (names[i]==NULL)
-- 
cgit v1.2.3