aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--dbm_map.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/dbm_map.c b/dbm_map.c
index ddcb032c..2207b555 100644
--- a/dbm_map.c
+++ b/dbm_map.c
@@ -1,4 +1,4 @@
-/* $Id: dbm_map.c,v 1.4 2016/08/22 16:07:16 schwarze Exp $ */
+/* $Id: dbm_map.c,v 1.5 2016/08/30 21:37:24 schwarze Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -143,7 +143,11 @@ void *
dbm_get(int32_t offset)
{
offset = be32toh(offset);
- if (offset < 0 || offset >= max_offset) {
+ if (offset < 0) {
+ warnx("dbm_get: Database corrupt: offset %d", offset);
+ return NULL;
+ }
+ if (offset >= max_offset) {
warnx("dbm_get: Database corrupt: offset %d > %d",
offset, max_offset);
return NULL;