From: Chad Sikorra Date: Sun, 26 Jun 2016 22:29:07 +0000 (-0500) Subject: Correctly add to the length of the final string X-Git-Tag: php-7.1.0beta1~151^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f910ca259f9be7dad7804eda19505490b4d5f132;p=php Correctly add to the length of the final string --- diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index bdb90f8add..3b952865c5 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -2837,7 +2837,7 @@ static zend_string* php_ldap_do_escape(const zend_bool *map, const char *value, if (flags & PHP_LDAP_ESCAPE_DN && value[0] == ' ') { len += 2; } - if (flags & PHP_LDAP_ESCAPE_DN && valuelen && value[valuelen - 1] == ' ') { + if (flags & PHP_LDAP_ESCAPE_DN && valuelen > 1 && value[valuelen - 1] == ' ') { len += 2; }