=================================================================== RCS file: /cvs/mandoc/mansearch.c,v retrieving revision 1.70 retrieving revision 1.71 diff -u -p -r1.70 -r1.71 --- mandoc/mansearch.c 2017/04/17 20:05:08 1.70 +++ mandoc/mansearch.c 2017/04/18 13:57:56 1.71 @@ -1,4 +1,4 @@ -/* $OpenBSD: mansearch.c,v 1.70 2017/04/17 20:05:08 schwarze Exp $ */ +/* $OpenBSD: mansearch.c,v 1.71 2017/04/18 13:57:56 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * Copyright (c) 2013-2017 Ingo Schwarze @@ -516,6 +516,8 @@ buildoutput(size_t im, struct dbm_page *page) output = mandoc_malloc(sz); i = 0; lstcat(output, &i, input, " # "); + output[i++] = '\0'; + assert(i == sz); return output; }