summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-01-11 12:47:51 +1100
committerAndrew Bartlett <abartlet@samba.org>2008-01-11 12:47:51 +1100
commit3dab82394ef950148f3da55c7d3179b0c9c05cc2 (patch)
treecd9397c869016e7b9b4104fae555105fac21454f /source4
parent3f7ec9bf191f2179c2112191d0c909e309411c29 (diff)
downloadsamba-3dab82394ef950148f3da55c7d3179b0c9c05cc2.tar.gz
samba-3dab82394ef950148f3da55c7d3179b0c9c05cc2.tar.bz2
samba-3dab82394ef950148f3da55c7d3179b0c9c05cc2.zip
Fix segfault when sorting LDAP replies on the client.
Andrew Bartlett (This used to be commit c72c39326b263b3aacd178ddc2fc3b1a2906f3d3)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/tools/ldbsearch.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c
index c33cba1d77..dba0549b44 100644
--- a/source4/lib/ldb/tools/ldbsearch.c
+++ b/source4/lib/ldb/tools/ldbsearch.c
@@ -241,10 +241,10 @@ again:
if (sctx->pending)
goto again;
- if (sctx->sort && sctx->num_stored != 0) {
+ if (sctx->sort && (sctx->num_stored != 0 || sctx->refs != 0)) {
int i;
- ldb_qsort(sctx->store, ret, sizeof(struct ldb_message *),
+ ldb_qsort(sctx->store, sctx->num_stored, sizeof(struct ldb_message *),
ldb, (ldb_qsort_cmp_fn_t)do_compare_msg);
if (ret != 0) {