summaryrefslogtreecommitdiff
path: root/source4/lib/tdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-02-24 01:10:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:10:53 -0500
commitb14727583d6108f11427ec8033986e9d617320c5 (patch)
tree74fe049d780fd12c91c4921e2ad5ebf80734524c /source4/lib/tdb
parent09879ff119838535a9c5daeb33f62c126b76fe25 (diff)
downloadsamba-b14727583d6108f11427ec8033986e9d617320c5.tar.gz
samba-b14727583d6108f11427ec8033986e9d617320c5.tar.bz2
samba-b14727583d6108f11427ec8033986e9d617320c5.zip
r5533: Patch to detect infinite loops when traversing a tdb from "Shlomi Yaakobovich" <Shlomi@exanet.com>
Jeremy. (This used to be commit 84f6d2b3dd29c1aa478708db9617a79382158f64)
Diffstat (limited to 'source4/lib/tdb')
-rw-r--r--source4/lib/tdb/common/tdb.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source4/lib/tdb/common/tdb.c b/source4/lib/tdb/common/tdb.c
index 134ee8a4ea..90b586d487 100644
--- a/source4/lib/tdb/common/tdb.c
+++ b/source4/lib/tdb/common/tdb.c
@@ -1314,6 +1314,13 @@ static int tdb_next_lock(TDB_CONTEXT *tdb, struct tdb_traverse_lock *tlock,
goto fail;
return tlock->off;
}
+
+ /* Detect infinite loops. From "Shlomi Yaakobovich" <Shlomi@exanet.com>. */
+ if (tlock->off == rec->next) {
+ TDB_LOG((tdb, 0, "tdb_next_lock: loop detected.\n"));
+ goto fail;
+ }
+
/* Try to clean dead ones from old traverses */
current = tlock->off;
tlock->off = rec->next;