summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2017-07-06 10:01:24 +1200
committerAndreas Schneider <asn@cryptomilk.org>2017-07-07 15:51:25 +0200
commit282410fa2416404962521ad6b2598a9c83b63594 (patch)
treea081764b3ef3c14f26b9b2a5c22472fe88dab2c8 /lib
parent963d9f12f902ae266a8c7edbf4249090de46173b (diff)
downloadsamba-282410fa2416404962521ad6b2598a9c83b63594.tar.gz
ldb: avoid searching empty lists in ldb_msg_find_common_values
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/ldb/common/ldb_msg.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/ldb/common/ldb_msg.c b/lib/ldb/common/ldb_msg.c
index 8e4047b41be..c2782db6fb2 100644
--- a/lib/ldb/common/ldb_msg.c
+++ b/lib/ldb/common/ldb_msg.c
@@ -207,6 +207,9 @@ int ldb_msg_find_common_values(struct ldb_context *ldb,
if (strcmp(el->name, el2->name) != 0) {
return LDB_ERR_INAPPROPRIATE_MATCHING;
}
+ if (el->num_values == 0 || el2->num_values == 0) {
+ return LDB_SUCCESS;
+ }
/*
With few values, it is better to do the brute-force search than the
clever search involving tallocs, memcpys, sorts, etc.