Description: Prevent null dereferencing in ldap_explode_dn()
Origin: vendor
Bug-Debian: http://bugs.debian.org/205405
Forwarded: no
Last-Update: 2010-01-18

--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -1212,7 +1212,7 @@ PHP_FUNCTION(ldap_explode_dn)
 	}
 
 	i=0;
-	while (ldap_value[i] != NULL) i++;
+	while (ldap_value && ldap_value[i] != NULL) i++;
 	count = i;
 
 	array_init(return_value);
@@ -1222,7 +1222,8 @@ PHP_FUNCTION(ldap_explode_dn)
 		add_index_string(return_value, i, ldap_value[i], 1);
 	}
 
-	ldap_value_free(ldap_value);
+	if (ldap_value)
+		ldap_value_free(ldap_value);
 }
 /* }}} */
 
