]> git.sur5r.net Git - openldap/commitdiff
null length string is not allowed
authorPierangelo Masarati <ando@openldap.org>
Sat, 2 Mar 2002 14:28:08 +0000 (14:28 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 2 Mar 2002 14:28:08 +0000 (14:28 +0000)
servers/slapd/schema_init.c

index b5ce9113f6c7c0a66a91008435f88352d0432fa8..b1febd47c2bf340c0cd7d0671cd9cd65c68f5d2a 100644 (file)
@@ -536,8 +536,13 @@ UTF8StringNormalize(
        /* All space is ASCII. All ASCII is 1 byte */
        for ( ; p < val->bv_val + val->bv_len && ASCII_SPACE( p[ 0 ] ); p++ );
 
-       ber_mem2bv( p, val->bv_len - (p - val->bv_val), 1, normalized );
-       e = normalized->bv_val + val->bv_len - (p - val->bv_val);
+       normalized->bv_len = val->bv_len - (p - val->bv_val);
+       if ( normalized->bv_len == 0 ) {
+               return LDAP_INVALID_SYNTAX;
+       }
+
+       ber_mem2bv( p, normalized->bv_len, 1, normalized );
+       e = normalized->bv_val + normalized->bv_len;
 
        assert( normalized->bv_val );