diff options
author | Johannes Schlüter <johannes@php.net> | 2009-06-25 15:19:29 +0000 |
---|---|---|
committer | Johannes Schlüter <johannes@php.net> | 2009-06-25 15:19:29 +0000 |
commit | 144ff4d6b3b131008002dcd15f2cc25817419eb0 (patch) | |
tree | 761c28e8f6dba153c97175e16a07ca18b9e196dd /ext/ldap/ldap.c | |
parent | 63543769246a323ddc011126830e2f03f55a39c7 (diff) | |
download | php-git-144ff4d6b3b131008002dcd15f2cc25817419eb0.tar.gz |
MFH: Fixed bug #48696 (ldap_read() segfaults with invalid parameters) (Felipe)
Diffstat (limited to 'ext/ldap/ldap.c')
-rw-r--r-- | ext/ldap/ldap.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 7f67e92f93..3aa830df59 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -589,7 +589,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) char *ldap_base_dn = NULL; char *ldap_filter = NULL; char **ldap_attrs = NULL; - ldap_linkdata *ld; + ldap_linkdata *ld = NULL; LDAPMessage *ldap_res; int ldap_attrsonly = 0; int ldap_sizelimit = -1; @@ -806,8 +806,10 @@ cleanup_parallel: } cleanup: - // Restoring previous options - php_set_opts(ld->link, old_ldap_sizelimit, old_ldap_timelimit, old_ldap_deref, &ldap_sizelimit, &ldap_timelimit, &ldap_deref); + if (ld) { + /* Restoring previous options */ + php_set_opts(ld->link, old_ldap_sizelimit, old_ldap_timelimit, old_ldap_deref, &ldap_sizelimit, &ldap_timelimit, &ldap_deref); + } if (ldap_attrs != NULL) { efree(ldap_attrs); } |