mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Cleanup overflow check
This commit is contained in:
parent
3b6122cb73
commit
ccfe26fca9
@ -2146,12 +2146,12 @@ integerVal2Key(
|
|||||||
/* Chop least significant digits, increase length instead */
|
/* Chop least significant digits, increase length instead */
|
||||||
if ( val.bv_len > k ) {
|
if ( val.bv_len > k ) {
|
||||||
chop = (val.bv_len-k+2)/INDEX_INTLEN_CHOP; /* 2 fewer digits */
|
chop = (val.bv_len-k+2)/INDEX_INTLEN_CHOP; /* 2 fewer digits */
|
||||||
val.bv_len -= chop * INDEX_INTLEN_CHOP; /* #digits chopped */
|
if ( chop > 0x7fffffff / INDEX_INTLEN_CHOPBYTES ) {
|
||||||
chop *= INDEX_INTLEN_CHOPBYTES; /* #bytes added */
|
|
||||||
if ( chop > 0x7fffffff ) {
|
|
||||||
memset( key->bv_val, neg ^ 0xff, index_intlen );
|
memset( key->bv_val, neg ^ 0xff, index_intlen );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
val.bv_len -= chop * INDEX_INTLEN_CHOP; /* #digits chopped */
|
||||||
|
chop *= INDEX_INTLEN_CHOPBYTES; /* #bytes added */
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( lutil_str2bin( &val, &itmp, ctx )) {
|
if ( lutil_str2bin( &val, &itmp, ctx )) {
|
||||||
|
Loading…
Reference in New Issue
Block a user