mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Fix UTF8stringvalidate loop termination (coverity)
This commit is contained in:
parent
67c13d0ccf
commit
45146ba21a
@ -1780,16 +1780,15 @@ UTF8StringValidate(
|
|||||||
Syntax *syntax,
|
Syntax *syntax,
|
||||||
struct berval *in )
|
struct berval *in )
|
||||||
{
|
{
|
||||||
ber_len_t count;
|
|
||||||
int len;
|
int len;
|
||||||
unsigned char *u = (unsigned char *)in->bv_val;
|
unsigned char *u = (unsigned char *)in->bv_val, *end = in->bv_val + in->bv_len;
|
||||||
|
|
||||||
if( BER_BVISEMPTY( in ) && syntax == slap_schema.si_syn_directoryString ) {
|
if( BER_BVISEMPTY( in ) && syntax == slap_schema.si_syn_directoryString ) {
|
||||||
/* directory strings cannot be empty */
|
/* directory strings cannot be empty */
|
||||||
return LDAP_INVALID_SYNTAX;
|
return LDAP_INVALID_SYNTAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( count = in->bv_len; count > 0; count -= len, u += len ) {
|
for( ; u < end; u += len ) {
|
||||||
/* get the length indicated by the first byte */
|
/* get the length indicated by the first byte */
|
||||||
len = LDAP_UTF8_CHARLEN2( u, len );
|
len = LDAP_UTF8_CHARLEN2( u, len );
|
||||||
|
|
||||||
@ -1827,7 +1826,7 @@ UTF8StringValidate(
|
|||||||
if( LDAP_UTF8_OFFSET( (char *)u ) != len ) return LDAP_INVALID_SYNTAX;
|
if( LDAP_UTF8_OFFSET( (char *)u ) != len ) return LDAP_INVALID_SYNTAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( count != 0 ) {
|
if( u >= len ) {
|
||||||
return LDAP_INVALID_SYNTAX;
|
return LDAP_INVALID_SYNTAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user