mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-12 10:54:48 +08:00
Fix integer overflow in slap_loglevel_get() - ITS#5035.
This commit is contained in:
parent
b4eddbb2a2
commit
c71a4ae4f3
@ -2445,7 +2445,7 @@ int
|
|||||||
slap_loglevel_get( struct berval *s, int *l )
|
slap_loglevel_get( struct berval *s, int *l )
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
unsigned long i;
|
unsigned i;
|
||||||
slap_mask_t m;
|
slap_mask_t m;
|
||||||
|
|
||||||
if ( loglevel_ops == NULL ) {
|
if ( loglevel_ops == NULL ) {
|
||||||
@ -2456,19 +2456,17 @@ slap_loglevel_get( struct berval *s, int *l )
|
|||||||
m |= loglevel_ops[ i ].mask;
|
m |= loglevel_ops[ i ].mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
m = ~m;
|
for ( i = 1; m & i; i <<= 1 )
|
||||||
|
|
||||||
for ( i = 1; i <= ( 1 << ( sizeof( int ) * 8 - 1 ) ) && !( m & i ); i <<= 1 )
|
|
||||||
;
|
;
|
||||||
|
|
||||||
if ( !( m & i ) ) {
|
if ( i == 0 ) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = slap_verbmasks_append( &loglevel_ops, i, s, loglevel_ignore );
|
rc = slap_verbmasks_append( &loglevel_ops, i, s, loglevel_ignore );
|
||||||
|
|
||||||
if ( rc != 0 ) {
|
if ( rc != 0 ) {
|
||||||
Debug( LDAP_DEBUG_ANY, "slap_loglevel_get(%lu, \"%s\") failed\n",
|
Debug( LDAP_DEBUG_ANY, "slap_loglevel_get(%u, \"%s\") failed\n",
|
||||||
i, s->bv_val, 0 );
|
i, s->bv_val, 0 );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user