mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix crash in LDAP search functions during argument validation
This commit is contained in:
parent
5ecc078a17
commit
b03438ba3a
2 changed files with 18 additions and 0 deletions
|
@ -1602,11 +1602,15 @@ cleanup_parallel:
|
|||
|
||||
if (!base_dn_str) {
|
||||
zend_argument_type_error(2, "must be of type string when argument #1 ($ldap) is a resource");
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
ldap_base_dn = zend_string_copy(base_dn_str);
|
||||
|
||||
if (!filter_str) {
|
||||
zend_argument_type_error(3, "must be of type string when argument #1 ($ldap) is a resource");
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
ldap_filter = zend_string_copy(filter_str);
|
||||
|
||||
|
|
|
@ -39,6 +39,18 @@ try {
|
|||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
|
||||
try {
|
||||
ldap_search($link, [], []);
|
||||
} catch (TypeError $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
|
||||
try {
|
||||
ldap_search($link, "", []);
|
||||
} catch (TypeError $exception) {
|
||||
echo $exception->getMessage() . "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ldap_search(): Search: No such object in %s on line %d
|
||||
|
@ -49,3 +61,5 @@ bool(false)
|
|||
ldap_search(): Argument #1 ($ldap) cannot be empty
|
||||
ldap_search(): Argument #2 ($base) must have the same number of elements as the links array
|
||||
ldap_search(): Argument #3 ($filter) must have the same number of elements as the links array
|
||||
ldap_search(): Argument #2 ($base) must be of type string when argument #1 ($ldap) is a resource
|
||||
ldap_search(): Argument #3 ($filter) must be of type string when argument #1 ($ldap) is a resource
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue