[php-src] Issue #16032: ext/ldap: Various NULL pointer dereferencements in `ldap_modify_batch()`

From: Date: Tue, 24 Sep 2024 23:10:04 +0000
Subject: [php-src] Issue #16032: ext/ldap: Various NULL pointer dereferencements in `ldap_modify_batch()`
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247886@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/16032 Author: Girgias ### Description The following code: ```php <?php /* We are assuming 3333 is not connectable */ $ldap = ldap_connect('ldap://127.0.0.1:3333'); $valid_dn = "cn=userA,something"; $modification_missing_attrib_key = [ [ "modtype" => LDAP_MODIFY_BATCH_ADD, "values" => ["value1"], ], ]; try { var_dump(ldap_modify_batch($ldap, $valid_dn, $modification_missing_attrib_key)); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ``` Resulted in this output: ``` home/girgias/Dev/php-src/ext/ldap/ldap.c:2762:28: runtime error: member access within null pointer of type 'struct zval' ``` But I expected this output instead: ``` A ValueError being thrown ``` Moreover, the following code: ```php <?php /* We are assuming 3333 is not connectable */ $ldap = ldap_connect('ldap://127.0.0.1:3333'); $valid_dn = "cn=userA,something"; $modification_missing_modtype_key = [ [ "attrib" => "attrib1", "values" => ["value1"], ], ]; try { var_dump(ldap_modify_batch($ldap, $valid_dn, $modification_missing_modtype_key)); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ``` Resulted in this output: ``` /home/girgias/Dev/php-src/ext/ldap/ldap.c:2741:11: runtime error: member access within null pointer of type 'struct zval' ``` But I expected this output instead: ``` A ValueError being thrown ``` ### PHP Version PHP 8.2 ### Operating System _No response_

« previous php.bugs (#247886) next »