diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2016-08-04 09:33:57 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2016-08-04 09:33:57 +0000 |
commit | 20e3c71a62a5c238318d6da050b80d3ce08f0281 (patch) | |
tree | 12e63b910bc84bb5a2161e5c61e5302ff61300f4 /dba_read.c | |
parent | 5e885aedc03fcf8c13fc9652c8e76da02e3a83d6 (diff) | |
download | mandoc-20e3c71a62a5c238318d6da050b80d3ce08f0281.tar.gz mandoc-20e3c71a62a5c238318d6da050b80d3ce08f0281.tar.zst mandoc-20e3c71a62a5c238318d6da050b80d3ce08f0281.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 'dba_read.c')
-rw-r--r-- | dba_read.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: dba_read.c,v 1.1 2016/07/19 21:31:55 schwarze Exp $ */ +/* $Id: dba_read.c,v 1.2 2016/08/04 09:33:57 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, |