summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/dba_read.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2016-08-17 20:46:06 +0000
committerschwarze <schwarze@openbsd.org>2016-08-17 20:46:06 +0000
commit289fdc1a87fd959053d8bda85d6806aa24b682c7 (patch)
tree0172bd3ef1497051038ce958026d06dc1bbc21e0 /usr.bin/mandoc/dba_read.c
parentWhen reading back a mandoc.db(5) file in order to apply incremental (diff)
downloadwireguard-openbsd-289fdc1a87fd959053d8bda85d6806aa24b682c7.tar.xz
wireguard-openbsd-289fdc1a87fd959053d8bda85d6806aa24b682c7.zip
When the content of a manual page does not specify a section, the
empty string got added to the list of sections, breaking the database format slightly and causing the page to not be considered part of any section, not even if a section could be deduced from the directory or from the file name. Bug found due to the bogus pcredemo(3) "manual" in the pcre-8.38p0 package.
Diffstat (limited to 'usr.bin/mandoc/dba_read.c')
-rw-r--r--usr.bin/mandoc/dba_read.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/mandoc/dba_read.c b/usr.bin/mandoc/dba_read.c
index cd4db383112..3ab4a397aa8 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.3 2016/08/17 18:58:31 schwarze Exp $ */
+/* $OpenBSD: dba_read.c,v 1.4 2016/08/17 20:46:06 schwarze Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -48,12 +48,11 @@ dba_read(const char *fname)
dba = dba_new(npages < 128 ? 128 : npages);
for (ip = 0; ip < npages; ip++) {
pdata = dbm_page_get(ip);
- page = dba_page_new(dba->pages, NULL, pdata->sect,
- pdata->arch, pdata->desc, pdata->file + 1, *pdata->file);
+ page = dba_page_new(dba->pages, pdata->arch,
+ pdata->desc, pdata->file + 1, *pdata->file);
for (cp = pdata->name; *cp != '\0'; cp = strchr(cp, '\0') + 1)
dba_page_add(page, DBP_NAME, cp);
- cp = pdata->sect;
- while (*(cp = strchr(cp, '\0') + 1) != '\0')
+ for (cp = pdata->sect; *cp != '\0'; cp = strchr(cp, '\0') + 1)
dba_page_add(page, DBP_SECT, cp);
if ((cp = pdata->arch) != NULL)
while (*(cp = strchr(cp, '\0') + 1) != '\0')