com php-src: Fix potentially uninitialized use in ldap: ext/ldap/ldap.c

From: Date: Thu, 29 Aug 2019 17:07:45 +0000
Subject: com php-src: Fix potentially uninitialized use in ldap: ext/ldap/ldap.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-108139@lists.php.net to get a copy of this message
Commit: 48ff226caeaef37863736297bbe807ac5ec4784b Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 29 Aug 2019 18:01:34 +0200 Parents: 6cc53981e5b69a8c9cba267a6dcbcd9569c928b6 Branches: PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=48ff226caeaef37863736297bbe807ac5ec4784b Log: Fix potentially uninitialized use in ldap If ctrl->ldctl_value.bv_len is zero context is uninitialized. Only free it if the call took place and succeeded. Changed paths: M ext/ldap/ldap.c Diff: diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 44c9e2f..d6fefb7 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -265,10 +265,10 @@ static void _php_ldap_control_to_array(LDAP *ld, LDAPControl* ctrl, zval* array, add_assoc_stringl(&value, "context", context->bv_val, context->bv_len); } add_assoc_zval(array, "value", &value); + ber_bvfree(context); } else { add_assoc_null(array, "value"); } - ber_bvfree(context); } else { if (ctrl->ldctl_value.bv_len) { add_assoc_stringl(array, "value", ctrl->ldctl_value.bv_val, ctrl->ldctl_value.bv_len);

« previous php.cvs (#108139) next »