mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
- Fixed bug #48696 (ldap_read() segfaults with invalid parameters)
This commit is contained in:
parent
ac88f10ea0
commit
a27158a76c
2 changed files with 15 additions and 3 deletions
|
@ -600,7 +600,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
|
||||||
char *ldap_base_dn = NULL;
|
char *ldap_base_dn = NULL;
|
||||||
char *ldap_filter = NULL;
|
char *ldap_filter = NULL;
|
||||||
char **ldap_attrs = NULL;
|
char **ldap_attrs = NULL;
|
||||||
ldap_linkdata *ld;
|
ldap_linkdata *ld = NULL;
|
||||||
LDAPMessage *ldap_res;
|
LDAPMessage *ldap_res;
|
||||||
int ldap_attrsonly = 0;
|
int ldap_attrsonly = 0;
|
||||||
int ldap_sizelimit = -1;
|
int ldap_sizelimit = -1;
|
||||||
|
@ -817,8 +817,10 @@ cleanup_parallel:
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
// Restoring previous options
|
if (ld) {
|
||||||
php_set_opts(ld->link, old_ldap_sizelimit, old_ldap_timelimit, old_ldap_deref, &ldap_sizelimit, &ldap_timelimit, &ldap_deref);
|
/* 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) {
|
if (ldap_attrs != NULL) {
|
||||||
efree(ldap_attrs);
|
efree(ldap_attrs);
|
||||||
}
|
}
|
||||||
|
|
10
ext/ldap/tests/bug48696.phpt
Normal file
10
ext/ldap/tests/bug48696.phpt
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #48696 (ldap_read() segfaults with invalid parameters)
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
ldap_read(1,1,1);
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Warning: ldap_read(): supplied argument is not a valid ldap link resource in %s on line %d
|
Loading…
Add table
Add a link
Reference in a new issue