summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-08-30 21:36:55 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-08-30 21:36:55 +0000
commitefeeff74d09032b7affa7b2983893cb44e773667 (patch)
treeffec2a827b3cddf7524ca91a9eda3c1de98c178f /usr.bin
parent68893de0a9f36efd135a7558d5a7b40bc2296cd2 (diff)
less confusing warning message about negative offsets
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/dbm_map.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/mandoc/dbm_map.c b/usr.bin/mandoc/dbm_map.c
index ce1e0660b76..875d6326523 100644
--- a/usr.bin/mandoc/dbm_map.c
+++ b/usr.bin/mandoc/dbm_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dbm_map.c,v 1.2 2016/08/22 16:05:56 schwarze Exp $ */
+/* $OpenBSD: dbm_map.c,v 1.3 2016/08/30 21:36:54 schwarze Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -133,7 +133,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;