Commit 8dbb532937e for php.net
commit 8dbb532937e50f58232d6dd05d6ed31b93d2ae8a
Merge: d23da75a227 a15654ece0c
Author: Ilia Alshanetsky <ilia@ilia.ws>
Date: Wed Jun 24 07:30:55 2026 -0400
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
Fix freeing uninitialized memory in LDAP sort control parsing
diff --cc ext/ldap/ldap.c
index 40d936bc422,2b3cb0e8a70..2c9fdb8e376
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@@ -580,11 -558,13 +580,12 @@@ static int php_ldap_control_from_array(
}
}
}
- } else if (strcmp(ZSTR_VAL(control_oid), LDAP_CONTROL_SORTREQUEST) == 0) {
- int num_keys, i;
+ } else if (zend_string_equals_literal(control_oid, LDAP_CONTROL_SORTREQUEST)) {
zval *sortkey, *tmp;
- num_keys = zend_hash_num_elements(Z_ARRVAL_P(val));
+ uint32_t num_keys = zend_hash_num_elements(Z_ARRVAL_P(val));
sort_keys = safe_emalloc((num_keys+1), sizeof(LDAPSortKey*), 0);
+ memset(sort_keys, 0, (num_keys+1) * sizeof(LDAPSortKey*));
tmpstrings1 = safe_emalloc(num_keys, sizeof(zend_string*), 0);
tmpstrings2 = safe_emalloc(num_keys, sizeof(zend_string*), 0);
num_tmpstrings1 = 0;