Commit ae63be38 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

DirectoryString syntaxes must have one or more octets to be valid.

parent df460af0
...@@ -310,6 +310,8 @@ UTF8StringValidate( ...@@ -310,6 +310,8 @@ UTF8StringValidate(
int len; int len;
unsigned char *u = in->bv_val; unsigned char *u = in->bv_val;
if( !in->bv_len ) return LDAP_INVALID_SYNTAX;
for( count = in->bv_len; count > 0; count-=len, u+=len ) { for( count = in->bv_len; count > 0; count-=len, u+=len ) {
/* get the length indicated by the first byte */ /* get the length indicated by the first byte */
len = LDAP_UTF8_CHARLEN( u ); len = LDAP_UTF8_CHARLEN( u );
...@@ -377,7 +379,7 @@ UTF8StringNormalize( ...@@ -377,7 +379,7 @@ UTF8StringNormalize(
assert( *newval->bv_val ); assert( *newval->bv_val );
assert( newval->bv_val < p ); assert( newval->bv_val < p );
assert( p <= q ); assert( p >= q );
/* cannot start with a space */ /* cannot start with a space */
assert( !ldap_utf8_isspace(newval->bv_val) ); assert( !ldap_utf8_isspace(newval->bv_val) );
...@@ -447,6 +449,8 @@ integerValidate( ...@@ -447,6 +449,8 @@ integerValidate(
{ {
ber_len_t i; ber_len_t i;
if( !val->bv_len ) return LDAP_INVALID_SYNTAX;
for(i=0; i < val->bv_len; i++) { for(i=0; i < val->bv_len; i++) {
if( !ASCII_DIGIT(val->bv_val[i]) ) return LDAP_INVALID_SYNTAX; if( !ASCII_DIGIT(val->bv_val[i]) ) return LDAP_INVALID_SYNTAX;
} }
...@@ -461,6 +465,8 @@ printableStringValidate( ...@@ -461,6 +465,8 @@ printableStringValidate(
{ {
ber_len_t i; ber_len_t i;
if( !val->bv_len ) return LDAP_INVALID_SYNTAX;
for(i=0; i < val->bv_len; i++) { for(i=0; i < val->bv_len; i++) {
if( !isprint(val->bv_val[i]) ) return LDAP_INVALID_SYNTAX; if( !isprint(val->bv_val[i]) ) return LDAP_INVALID_SYNTAX;
} }
...@@ -475,6 +481,8 @@ IA5StringValidate( ...@@ -475,6 +481,8 @@ IA5StringValidate(
{ {
ber_len_t i; ber_len_t i;
if( !val->bv_len ) return LDAP_INVALID_SYNTAX;
for(i=0; i < val->bv_len; i++) { for(i=0; i < val->bv_len; i++) {
if( !isascii(val->bv_val[i]) ) return LDAP_INVALID_SYNTAX; if( !isascii(val->bv_val[i]) ) return LDAP_INVALID_SYNTAX;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment