summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/dba_read.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2016-08-04 09:33:53 +0000
committerschwarze <schwarze@openbsd.org>2016-08-04 09:33:53 +0000
commita250d9f140eddb19e8853041b6df0238c51f2061 (patch)
treebb3b8e37e47a1d7da36435bcf76e0d64f742ebd5 /usr.bin/mandoc/dba_read.c
parentadjust database file name and version number to what was committed (diff)
downloadwireguard-openbsd-a250d9f140eddb19e8853041b6df0238c51f2061.tar.xz
wireguard-openbsd-a250d9f140eddb19e8853041b6df0238c51f2061.zip
Fix an assertion failure that happened when trying to add a page
with makewhatis -d to a completely empty database. Reported by Mark Patruck <mark at wrapped dot cx>, thanks!
Diffstat (limited to 'usr.bin/mandoc/dba_read.c')
-rw-r--r--usr.bin/mandoc/dba_read.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/mandoc/dba_read.c b/usr.bin/mandoc/dba_read.c
index c7128de2849..b260ac1fca7 100644
--- a/usr.bin/mandoc/dba_read.c
+++ b/usr.bin/mandoc/dba_read.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dba_read.c,v 1.1 2016/08/01 10:32:39 schwarze Exp $ */
+/* $OpenBSD: dba_read.c,v 1.2 2016/08/04 09:33:53 schwarze Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -45,7 +45,7 @@ dba_read(const char *fname)
if (dbm_open(fname) == -1)
return NULL;
npages = dbm_page_count();
- dba = dba_new(npages);
+ dba = dba_new(npages < 128 ? 128 : npages);
for (ip = 0; ip < npages; ip++) {
pdata = dbm_page_get(ip);
page = dba_page_new(dba->pages, pdata->name, pdata->sect,