From b7f3bb05f58d143fabc36958014fd9a1d6d18b1d Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 30 Nov 2007 18:12:17 +0000 Subject: [PATCH] Fix 1.426, must sign-extend small numbers, not zero-pad --- servers/slapd/schema_init.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index ee96f4e686..3d9cbb3b61 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -2161,13 +2161,17 @@ integerIndexer( rc = LDAP_INVALID_SYNTAX; goto leave; } - /* If too small, pad with zeros */ + /* If too small, sign-extend */ if ( iv.bv_len < index_intlen ) { - int j, k; + int j, k, pad; keys[i].bv_val[0] = index_intlen; + if (iv.bv_val[0] & 0x80) + pad = 0xff; + else + pad = 0; k = index_intlen - iv.bv_len + 1; for ( j=1; j