mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
add more sanity checks (ITS#5136)
This commit is contained in:
parent
927efd4a94
commit
9f36fafe55
@ -718,7 +718,21 @@ ordered_value_add(
|
||||
}
|
||||
|
||||
new = ch_malloc( (anum+vnum+1) * sizeof(struct berval));
|
||||
if ( ( a->a_nvals && a->a_nvals != a->a_vals ) || ( nvals != NULL && nvals != vals ) ) {
|
||||
|
||||
/* sanity check: if normalized modifications come in, either
|
||||
* no values are present or normalized existing values differ
|
||||
* from non-normalized; if no normalized modifications come in,
|
||||
* either no values are present or normalized existing values
|
||||
* don't differ from non-normalized */
|
||||
if ( nvals != NULL ) {
|
||||
assert( nvals != vals );
|
||||
assert( a->a_nvals == NULL || a->a_nvals != a->a_vals );
|
||||
|
||||
} else {
|
||||
assert( a->a_nvals == NULL || a->a_nvals == a->a_vals );
|
||||
}
|
||||
|
||||
if ( ( a->a_nvals && a->a_nvals != a->a_vals ) || nvals != NULL ) {
|
||||
nnew = ch_malloc( (anum+vnum+1) * sizeof(struct berval));
|
||||
/* Shouldn't happen... */
|
||||
if ( !nvals ) nvals = vals;
|
||||
|
Loading…
Reference in New Issue
Block a user