1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

Port from SAMBA tdb: commit a91bcbccf8 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)
This commit is contained in:
Rusty Russell 2009-07-29 14:49:57 +09:30
parent c153b85a93
commit f10db37b82

View File

@ -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);