diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-07-17 09:06:58 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:29:34 -0500 |
commit | 6e4bcaffa051f69f4e6595cf7d659ec22a22ef21 (patch) | |
tree | f7c06020d53ba04d6486d319c3505a57abd2e2ad | |
parent | 54c30b05854e15031eb490fc5f45205329c81001 (diff) | |
download | samba-6e4bcaffa051f69f4e6595cf7d659ec22a22ef21.tar.gz samba-6e4bcaffa051f69f4e6595cf7d659ec22a22ef21.tar.bz2 samba-6e4bcaffa051f69f4e6595cf7d659ec22a22ef21.zip |
r8517: fixed a crash bug in ldb_dn_compare_base()
(This used to be commit 19d789e82526eff236aeed77ddc8d2606c5118b6)
-rw-r--r-- | source4/lib/ldb/common/ldb_dn.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c index 3cdc7ba85f..edb5124d99 100644 --- a/source4/lib/ldb/common/ldb_dn.c +++ b/source4/lib/ldb/common/ldb_dn.c @@ -412,13 +412,13 @@ int ldb_dn_compare_base(struct ldb_context *ldb, const struct ldb_dn *base, const struct ldb_dn *dn) { - int i, ret; + int ret; int n0, n1; /* if the number of components doesn't match they differ */ n0 = base->comp_num - 1; n1 = dn->comp_num - 1; - for (i = 0; i < base->comp_num; i++, n0--, n1--) { + while (n0 >= 0 && n1 >= 0) { const struct ldb_attrib_handler *h; /* compare names (attribute names are guaranteed to be ASCII only) */ @@ -435,6 +435,8 @@ int ldb_dn_compare_base(struct ldb_context *ldb, if (ret) { return ret; } + n1--; + n0--; } return 0; |