From fbd96006c48de87b8ae3194d10ffdf34bd3f9461 Mon Sep 17 00:00:00 2001 From: jbj Date: Fri, 15 Nov 2002 18:29:34 +0000 Subject: Apply patch.4.1.24.6: 6.Fix a bug where Berkeley DB could overwrite incorrectly formatted files rather than returning an error to the application during open. CVS patchset: 5869 CVS date: 2002/11/15 18:29:34 --- db/db/db_open.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/db/db/db_open.c b/db/db/db_open.c index 66ea247cb..19413a5cf 100644 --- a/db/db/db_open.c +++ b/db/db/db_open.c @@ -8,7 +8,7 @@ #include "db_config.h" #ifndef lint -static const char revid[] = "Id: db_open.c,v 11.214 2002/08/07 16:16:47 bostic Exp "; +static const char revid[] = "Id: db_open.c,v 11.215 2002/08/15 15:27:52 bostic Exp "; #endif /* not lint */ #ifndef NO_SYSTEM_INCLUDES @@ -460,8 +460,7 @@ __db_chk_meta(dbenv, dbp, meta, do_metachk) } #ifdef HAVE_CRYPTO - ret = __crypto_decrypt_meta(dbenv, dbp, (u_int8_t *)meta, - DBMETASIZE, do_metachk); + ret = __crypto_decrypt_meta(dbenv, dbp, (u_int8_t *)meta, do_metachk); #endif return (ret); } @@ -537,11 +536,9 @@ swap_retry: * and even a checksum error isn't a reason to panic the environment. */ if ((ret = __db_chk_meta(dbenv, dbp, meta, do_metachk)) != 0) { - if (ret == -1) { + if (ret == -1) __db_err(dbenv, "%s: metadata page checksum error", name); - ret = EINVAL; - } goto bad_format; } @@ -578,7 +575,7 @@ swap_retry: bad_format: __db_err(dbenv, "%s: unexpected file type or format", name); - return (ret); + return (ret == 0 ? EINVAL : ret); } /* -- cgit v1.2.3