mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
ITS#4186 hdb_idl_append() must not alter the tmp input.
This commit is contained in:
parent
210638e3c5
commit
3429c5a566
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user