From: Howard Chu Date: Sun, 20 Nov 2005 22:02:41 +0000 (+0000) Subject: ITS#4186 hdb_idl_append() must not alter the tmp input. X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~757 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3429c5a566c7fe4e532f4e7de62c9289e0609525;p=openldap ITS#4186 hdb_idl_append() must not alter the tmp input. --- 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; }