[php-src] PR #22342: Fix freeing uninitialized memory in LDAP sort control parsing

From: Date: Tue, 16 Jun 2026 21:28:34 +0000
Subject: [php-src] PR #22342: Fix freeing uninitialized memory in LDAP sort control parsing
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-36471@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/22342 Author: iliaal _php_ldap_control_from_array() allocated the sort_keys array with safe_emalloc() and wrote its NULL terminator only after the per-key loop. A sort key missing the "attr" entry bails out of the loop early, so the array is partially uninitialized when the failure cleanup walks it as a NULL-terminated list and efree()s the unwritten slots. Allocate it zeroed with ecalloc() so those slots read NULL; the sibling tmpstrings arrays are freed by a counter and stay safe_emalloc. Reachable from userland via the $controls argument of ldap_search() and the other control-taking LDAP functions.

« previous php.git-pulls (#36471) next »