lists.arthurdejong.org
RSS feed

nss-pam-ldapd branch master updated. 0.9.12-17-g91bb8c9

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd branch master updated. 0.9.12-17-g91bb8c9



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "nss-pam-ldapd".

The branch, master has been updated
       via  91bb8c995f977d289077e6a6dceff74f4aed60b6 (commit)
      from  b7841fc5647fafcea9258e13190ee2058dd4e7b0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/nss-pam-ldapd/commit/?id=91bb8c995f977d289077e6a6dceff74f4aed60b6

commit 91bb8c995f977d289077e6a6dceff74f4aed60b6
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Tue Aug 27 21:20:29 2024 +0200

    Fix NULL pointer deref on memory allocation failure
    
    This fixes a NULL pointer dereference when a call to malloc() failed.
    
    Closes https://github.com/arthurdejong/nss-pam-ldapd/issues/70

diff --git a/nslcd/passwd.c b/nslcd/passwd.c
index a4e2678..59b21d0 100644
--- a/nslcd/passwd.c
+++ b/nslcd/passwd.c
@@ -5,7 +5,7 @@
 
    Copyright (C) 1997-2005 Luke Howard
    Copyright (C) 2006 West Consulting
-   Copyright (C) 2006-2017 Arthur de Jong
+   Copyright (C) 2006-2024 Arthur de Jong
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -293,8 +293,16 @@ char *dn2uid(MYLDAP_SESSION *session, const char *dn, char 
*buf, size_t buflen)
   /* see if we have a cached entry */
   pthread_mutex_lock(&dn2uid_cache_mutex);
   if (dn2uid_cache == NULL)
+  {
     dn2uid_cache = dict_new();
-  if ((dn2uid_cache != NULL) && ((cacheentry = dict_get(dn2uid_cache, dn)) != 
NULL))
+    if (dn2uid_cache == NULL)
+    {
+      log_log(LOG_ERR, "dict_new() failed to allocate memory");
+      pthread_mutex_unlock(&dn2uid_cache_mutex);
+      return NULL;
+    }
+  }
+  if ((cacheentry = dict_get(dn2uid_cache, dn)) != NULL)
   {
     if ((cacheentry->uid != NULL) && (strlen(cacheentry->uid) < buflen))
     {

-----------------------------------------------------------------------

Summary of changes:
 nslcd/passwd.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
nss-pam-ldapd