From b14727583d6108f11427ec8033986e9d617320c5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 24 Feb 2005 01:10:57 +0000 Subject: r5533: Patch to detect infinite loops when traversing a tdb from "Shlomi Yaakobovich" Jeremy. (This used to be commit 84f6d2b3dd29c1aa478708db9617a79382158f64) --- source4/lib/tdb/common/tdb.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source4/lib') 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" . */ + 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; -- cgit