aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-11-19 19:22:07 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-11-19 19:22:07 +0000
commit6236555172624d1a801353c70f49a37fe242afd4 (patch)
treeb3acd15276bf35fb03f3d0275b5f8f5aa1a66ac3
parentbeb65cfe9fde781fdc8726740fe0b0dd70a84b16 (diff)
downloadmandoc-6236555172624d1a801353c70f49a37fe242afd4.tar.gz
mandoc-6236555172624d1a801353c70f49a37fe242afd4.tar.zst
mandoc-6236555172624d1a801353c70f49a37fe242afd4.zip
Correctly construct empty lists in dbm_page_get().
Original commit message by the author of this bugfix patch, bluhm@: lstmatch() expects a list of strings separated by \0 and terminated with \0\0. In the NULL case dbm_page_get() returned only simple strings so correct processing was depending on data layout. Use an additional \0 to terminate the single string lists. Found by mandoc regress since llvm linker on amd64 arranges strings differently.
-rw-r--r--dbm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/dbm.c b/dbm.c
index 4aedf66d..f6b1259e 100644
--- a/dbm.c
+++ b/dbm.c
@@ -1,4 +1,4 @@
-/* $Id: dbm.c,v 1.5 2016/10/18 22:27:25 schwarze Exp $ */
+/* $Id: dbm.c,v 1.6 2018/11/19 19:22:07 schwarze Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -151,17 +151,17 @@ dbm_page_get(int32_t ip)
assert(ip < npages);
res.name = dbm_get(pages[ip].name);
if (res.name == NULL)
- res.name = "(NULL)";
+ res.name = "(NULL)\0";
res.sect = dbm_get(pages[ip].sect);
if (res.sect == NULL)
- res.sect = "(NULL)";
+ res.sect = "(NULL)\0";
res.arch = pages[ip].arch ? dbm_get(pages[ip].arch) : NULL;
res.desc = dbm_get(pages[ip].desc);
if (res.desc == NULL)
res.desc = "(NULL)";
res.file = dbm_get(pages[ip].file);
if (res.file == NULL)
- res.file = " (NULL)";
+ res.file = " (NULL)\0";
res.addr = dbm_addr(pages + ip);
return &res;
}