aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dbm_map.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-08-30 21:37:24 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-08-30 21:37:24 +0000
commite4c83815ad1c33d67a9d2078e7eebbbeeb00dd15 (patch)
tree941dbb7c029c28845332bd148ce6f2bf9432963c /dbm_map.c
parent1cc34c3d5e9401c485dbb91124f6789f0101137d (diff)
downloadmandoc-e4c83815ad1c33d67a9d2078e7eebbbeeb00dd15.tar.gz
mandoc-e4c83815ad1c33d67a9d2078e7eebbbeeb00dd15.tar.zst
mandoc-e4c83815ad1c33d67a9d2078e7eebbbeeb00dd15.zip
less confusing warning message about negative offsets
Diffstat (limited to 'dbm_map.c')
-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;