diff options
| author | Felipe Pena <felipe@php.net> | 2009-06-25 14:48:53 +0000 |
|---|---|---|
| committer | Felipe Pena <felipe@php.net> | 2009-06-25 14:48:53 +0000 |
| commit | a27158a76c1416b20097f82df524bb6028b159fd (patch) | |
| tree | 0d22b7f175079f17c71a08c2776aa7e311e95c46 /ext/ldap/ldap.c | |
| parent | ac88f10ea04a44d5c8a63cd7eef691b4eed86a23 (diff) | |
| download | php-git-a27158a76c1416b20097f82df524bb6028b159fd.tar.gz | |
- Fixed bug #48696 (ldap_read() segfaults with invalid parameters)
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 a9037136a5..962c1c31d6 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -600,7 +600,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; @@ -817,8 +817,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); } |
