diff options
author | Côme Chilliet <mcmic@php.net> | 2019-04-15 10:16:29 +0200 |
---|---|---|
committer | Côme Chilliet <mcmic@php.net> | 2019-04-15 10:16:29 +0200 |
commit | ea0f26420dbfca5c90c76622ca177ffe20352cfd (patch) | |
tree | 45b63ea20913c366ffd284757fc2415efc94fd32 | |
parent | 7f551c728cf6ae27f1d6df3a8aaf48b8874cdce3 (diff) | |
download | php-git-ea0f26420dbfca5c90c76622ca177ffe20352cfd.tar.gz |
Fix a NULL dereferencing crash in php-ldap
This happens when parsing a control response to a VLV request which does
not contain a "context" string.
See bug #77869
-rw-r--r-- | ext/ldap/ldap.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 35e0c06e82..55a215a587 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -259,7 +259,9 @@ static void _php_ldap_control_to_array(LDAP *ld, LDAPControl* ctrl, zval* array, add_assoc_long(&value, "target", target); add_assoc_long(&value, "count", count); add_assoc_long(&value, "errcode", errcode); - add_assoc_stringl(&value, "context", context->bv_val, context->bv_len); + if ( context && (context->bv_len >= 0) ) { + add_assoc_stringl(&value, "context", context->bv_val, context->bv_len); + } add_assoc_zval(array, "value", &value); } else { add_assoc_null(array, "value"); |