diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-07-29 14:49:57 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2009-08-04 16:43:14 +0930 |
commit | f10db37b82859750ae8fbf7b8ce2f0bab3b13669 (patch) | |
tree | 0c0e76bd8230bb136d827f725afd10c04d052243 /ctdb | |
parent | c153b85a93c95452ae316aebdf599a85b7124ab7 (diff) | |
download | samba-f10db37b82859750ae8fbf7b8ce2f0bab3b13669.tar.gz samba-f10db37b82859750ae8fbf7b8ce2f0bab3b13669.tar.xz samba-f10db37b82859750ae8fbf7b8ce2f0bab3b13669.zip |
Port from SAMBA tdb: commit a91bcbccf8a2243dac57cacec6fdfc9907580f69 Author: Jim McDonough <jmcd@samba.org> Date: Thu May 21 16:26:26 2009 -0400
Detect tight loop in tdb_find()
(This used to be ctdb commit 5253a0ba3a34fbf5810f363ecc094203d49e835f)
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/lib/tdb/common/tdb.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ctdb/lib/tdb/common/tdb.c b/ctdb/lib/tdb/common/tdb.c index 767452c9b34..b4dc86a82cb 100644 --- a/ctdb/lib/tdb/common/tdb.c +++ b/ctdb/lib/tdb/common/tdb.c @@ -96,6 +96,11 @@ static tdb_off_t tdb_find(struct tdb_context *tdb, TDB_DATA key, uint32_t hash, NULL) == 0) { return rec_ptr; } + /* detect tight infinite loop */ + if (rec_ptr == r->next) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_find: loop detected.\n")); + return TDB_ERRCODE(TDB_ERR_CORRUPT, 0); + } rec_ptr = r->next; } return TDB_ERRCODE(TDB_ERR_NOEXIST, 0); |