summaryrefslogtreecommitdiff
path: root/lib/tdb/common
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2009-05-21 16:26:26 -0400
committerJim McDonough <jmcd@samba.org>2009-05-21 16:29:48 -0400
commita91bcbccf8a2243dac57cacec6fdfc9907580f69 (patch)
treebf0265b5f359a10e58fb2d774dfdf3c6abf31f19 /lib/tdb/common
parent96ede10cfb3b939b6d69e635baef3c8694bbc1f6 (diff)
downloadsamba-a91bcbccf8a2243dac57cacec6fdfc9907580f69.tar.gz
samba-a91bcbccf8a2243dac57cacec6fdfc9907580f69.tar.bz2
samba-a91bcbccf8a2243dac57cacec6fdfc9907580f69.zip
Detect tight loop in tdb_find()
Diffstat (limited to 'lib/tdb/common')
-rw-r--r--lib/tdb/common/tdb.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/tdb/common/tdb.c b/lib/tdb/common/tdb.c
index 8c61ec1a89..b59bb1571c 100644
--- a/lib/tdb/common/tdb.c
+++ b/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);