From 3429c5a566c7fe4e532f4e7de62c9289e0609525 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 20 Nov 2005 22:02:41 +0000 Subject: [PATCH] ITS#4186 hdb_idl_append() must not alter the tmp input. --- servers/slapd/back-bdb/idl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/servers/slapd/back-bdb/idl.c b/servers/slapd/back-bdb/idl.c index d43d210e33..c29d9228ce 100644 --- a/servers/slapd/back-bdb/idl.c +++ b/servers/slapd/back-bdb/idl.c @@ -1311,7 +1311,7 @@ int bdb_idl_append_one( ID *ids, ID id ) */ int bdb_idl_append( ID *a, ID *b ) { - ID ida, idb, tmp; + ID ida, idb, tmp, swap = 0; if ( BDB_IDL_IS_ZERO( b ) ) { return 0; @@ -1333,6 +1333,7 @@ int bdb_idl_append( ID *a, ID *b ) } if ( b[0] > 1 && ida > idb ) { + swap = idb; a[a[0]] = idb; b[b[0]] = ida; } @@ -1351,6 +1352,9 @@ int bdb_idl_append( ID *a, ID *b ) AC_MEMCPY(a+a[0]+1, b+2, i * sizeof(ID)); a[0] += i; } + if ( swap ) { + b[b[0]] = swap; + } return 0; } -- 2.39.5