]> granicus.if.org Git - php/commitdiff
Correctly add to the length of the final string
authorChad Sikorra <Chad.Sikorra@gmail.com>
Sun, 26 Jun 2016 22:29:07 +0000 (17:29 -0500)
committerChad Sikorra <Chad.Sikorra@gmail.com>
Sun, 26 Jun 2016 22:29:07 +0000 (17:29 -0500)
ext/ldap/ldap.c

index bdb90f8addba3eef88888768d01fefcb7f5176f7..3b952865c5b735b6bf77011e02b3bd41cf7ee6e9 100644 (file)
@@ -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;
        }