From 6f45cbf42738d869e310027c05e0a5bba07de9fc Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 4 Mar 2018 11:26:37 +0100 Subject: [PATCH] tdb: Harden allocating the tdb recovery area Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- lib/tdb/common/transaction.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c index 7d281fc75ff..6a5338c5faf 100644 --- a/lib/tdb/common/transaction.c +++ b/lib/tdb/common/transaction.c @@ -689,6 +689,8 @@ int tdb_recovery_area(struct tdb_context *tdb, tdb_off_t *recovery_offset, struct tdb_record *rec) { + int ret; + if (tdb_ofs_read(tdb, TDB_RECOVERY_HEAD, recovery_offset) == -1) { return -1; } @@ -709,6 +711,13 @@ int tdb_recovery_area(struct tdb_context *tdb, *recovery_offset = 0; rec->rec_len = 0; } + + ret = methods->tdb_oob(tdb, *recovery_offset, rec->rec_len, 1); + if (ret == -1) { + *recovery_offset = 0; + rec->rec_len = 0; + } + return 0; } -- 2.11.4.GIT