summaryrefslogtreecommitdiff
path: root/source3/tdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-02-24 01:07:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:55:45 -0500
commitf7decc6b2316e7c24ef39966f2defc441814f11b (patch)
treee1ba83fa38e3a0d3b1a713c84431d55521e93980 /source3/tdb
parentcb203b2d1ec1eec67c3b9347c59230504c68d0b7 (diff)
downloadsamba-f7decc6b2316e7c24ef39966f2defc441814f11b.tar.gz
samba-f7decc6b2316e7c24ef39966f2defc441814f11b.tar.bz2
samba-f7decc6b2316e7c24ef39966f2defc441814f11b.zip
r5532: Patch to detect infinite loops when traversing a tdb from "Shlomi Yaakobovich" <Shlomi@exanet.com>
Jeremy. (This used to be commit f997c28bb8ca253dca943a578a617b3c20ccfa5e)
Diffstat (limited to 'source3/tdb')
-rw-r--r--source3/tdb/tdb.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index 45895d2ec7..b3d596f442 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -1272,6 +1272,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;