From ccfe26fca9f4a8d235af58d8959c6052e4487c21 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 2 Dec 2007 21:46:50 +0000 Subject: [PATCH] Cleanup overflow check --- servers/slapd/schema_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index df955ade6e..38af3d2ffa 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -2146,12 +2146,12 @@ integerVal2Key( /* Chop least significant digits, increase length instead */ if ( val.bv_len > k ) { chop = (val.bv_len-k+2)/INDEX_INTLEN_CHOP; /* 2 fewer digits */ - val.bv_len -= chop * INDEX_INTLEN_CHOP; /* #digits chopped */ - chop *= INDEX_INTLEN_CHOPBYTES; /* #bytes added */ - if ( chop > 0x7fffffff ) { + if ( chop > 0x7fffffff / INDEX_INTLEN_CHOPBYTES ) { memset( key->bv_val, neg ^ 0xff, index_intlen ); return 0; } + val.bv_len -= chop * INDEX_INTLEN_CHOP; /* #digits chopped */ + chop *= INDEX_INTLEN_CHOPBYTES; /* #bytes added */ } if ( lutil_str2bin( &val, &itmp, ctx )) { -- 2.39.5