From 92986c34342f72c7eff3337817d0697ea073fc0f Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Mon, 22 Nov 2010 12:16:08 +0000 Subject: [PATCH] ITS#6715 cleanup: Handle attr_valfind(0 values) when SLAP_ATTR_SORTED_VALS --- servers/slapd/attr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/servers/slapd/attr.c b/servers/slapd/attr.c index 4fcb7dc42f..4472d7c6ff 100644 --- a/servers/slapd/attr.c +++ b/servers/slapd/attr.c @@ -317,11 +317,11 @@ attr_valfind( } n = a->a_numvals; - if ( a->a_flags & SLAP_ATTR_SORTED_VALS ) { + if ( (a->a_flags & SLAP_ATTR_SORTED_VALS) && n ) { /* Binary search */ unsigned base = 0; - while ( 0 < n ) { + do { unsigned pivot = n >> 1; i = base + pivot; rc = value_match( &match, a->a_desc, mr, flags, @@ -334,7 +334,7 @@ attr_valfind( } else { n = pivot; } - } + } while ( n ); if ( match < 0 ) i++; } else { -- 2.39.5