forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ext/ldap: Fix phpGH-16101 (Segfaults in php_ldap_do_search() when LDA…
…Ps is not a list)
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--TEST-- | ||
Bug GH-16101: Segfault in ldap_list(), ldap_read(), and ldap_search() when LDAPs array is not a list | ||
--EXTENSIONS-- | ||
ldap | ||
--FILE-- | ||
<?php | ||
|
||
/* We are assuming 3333 is not connectable */ | ||
$ldap = ldap_connect('ldap://127.0.0.1:3333'); | ||
$valid_dn = "cn=userA,something"; | ||
$valid_filter = ""; | ||
|
||
$ldaps_dict = [ | ||
"hello" => $ldap, | ||
"world" => $ldap, | ||
]; | ||
try { | ||
var_dump(ldap_list($ldaps_dict, $valid_dn, $valid_filter)); | ||
} catch (Throwable $e) { | ||
echo $e::class, ': ', $e->getMessage(), PHP_EOL; | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
ValueError: ldap_list(): Argument #1 ($ldap) must be a list |