1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 03:03:26 +02:00

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.
This commit is contained in:
Nikita Popov
2019-08-29 18:01:34 +02:00
parent 6cc53981e5
commit 48ff226cae
+1 -1
View File
@@ -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);