summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2016-08-30 21:36:54 +0000
committerschwarze <schwarze@openbsd.org>2016-08-30 21:36:54 +0000
commit467e53f5cc713a219db94807b5ad29ae82c47f2c (patch)
treeb13c8f16163cccfdb390663a88a29bb5ab3c1e36
parentwhen configuring the daemon, assign values to the structure being conf-ed, (diff)
downloadwireguard-openbsd-467e53f5cc713a219db94807b5ad29ae82c47f2c.tar.xz
wireguard-openbsd-467e53f5cc713a219db94807b5ad29ae82c47f2c.zip
less confusing warning message about negative offsets
-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;