git.samba.org
/
sahlberg
/
ctdb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
aa22d18
)
Port from SAMBA tdb: commit a91bcbccf8a2243dac57cacec6fdfc9907580f69 Author: Jim...
author
Rusty Russell
<rusty@rustcorp.com.au>
Wed, 29 Jul 2009 05:19:57 +0000
(14:49 +0930)
committer
Rusty Russell
<rusty@rustcorp.com.au>
Tue, 4 Aug 2009 07:13:14 +0000
(16:43 +0930)
Detect tight loop in tdb_find()
lib/tdb/common/tdb.c
patch
|
blob
|
history
diff --git
a/lib/tdb/common/tdb.c
b/lib/tdb/common/tdb.c
index 767452c9b34b520a51bed6aace888b3f5b2dcd4f..b4dc86a82cb13d61bb5cc43dbeeb61bfc35ec9e4 100644
(file)
--- 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);