Skip to content

Commit a246102

Browse files
committed
Merge branch 'PHP-8.4'
2 parents 9b6df10 + 0afe0bb commit a246102

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

ext/ldap/ldap.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4041,6 +4041,11 @@ static void php_ldap_exop(INTERNAL_FUNCTION_PARAMETERS, bool force_sync) {
40414041
RETURN_THROWS();
40424042
}
40434043

4044+
if (ZSTR_LEN(reqoid) == 0) {
4045+
zend_argument_must_not_be_empty_error(2);
4046+
RETURN_THROWS();
4047+
}
4048+
40444049
ld = Z_LDAP_LINK_P(link);
40454050
VERIFY_LDAP_LINK_CONNECTED(ld);
40464051

ext/ldap/tests/gh18902.phpt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
GH-17704 (ldap_search fails when $attributes contains a non-packed array with numerical keys)
3+
--EXTENSIONS--
4+
ldap
5+
--FILE--
6+
<?php
7+
$conn = ldap_connect();
8+
9+
try {
10+
ldap_exop($conn,"\0");
11+
} catch (\ValueError $e) {
12+
echo $e->getMessage(), PHP_EOL;
13+
}
14+
15+
try {
16+
ldap_exop_sync($conn,"");
17+
} catch (\ValueError $e) {
18+
echo $e->getMessage(), PHP_EOL;
19+
}
20+
21+
try {
22+
ldap_exop_sync($conn,"test\0");
23+
} catch (\ValueError $e) {
24+
echo $e->getMessage(), PHP_EOL;
25+
}
26+
?>
27+
--EXPECTF--
28+
ldap_exop(): Argument #2 ($request_oid) must not contain any null bytes
29+
ldap_exop_sync(): Argument #2 ($request_oid) must not be empty
30+
ldap_exop_sync(): Argument #2 ($request_oid) must not contain any null bytes

0 commit comments

Comments
 (0)