From f0d75718880a0e3a9bc6de185951e94817f59510 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Mon, 15 Oct 2012 17:39:14 +0200 Subject: LDAP: Check validity of naming_context https://fedorahosted.org/sssd/ticket/1581 If the namingContext attribute had no values or multiple values, then our code would dereference a NULL pointer. --- src/providers/ldap/sdap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/ldap/sdap.c b/src/providers/ldap/sdap.c index be80e51c3..c2dccb11d 100644 --- a/src/providers/ldap/sdap.c +++ b/src/providers/ldap/sdap.c @@ -709,7 +709,7 @@ static char *get_naming_context(TALLOC_CTX *mem_ctx, * a zero-length namingContexts value in some situations. In this * case, we should return it as NULL so things fail gracefully. */ - if (naming_context[0] == '\0') { + if (naming_context && naming_context[0] == '\0') { talloc_zfree(naming_context); } -- cgit