From fc7115c3f44c19cecd1680440f3c31f14407b4d8 Mon Sep 17 00:00:00 2001 From: wiz Date: Fri, 1 Aug 2014 12:55:00 +0000 Subject: [PATCH] Fix an off by one bug in apropos. The bug is in the html output where some garbage characters are seen in the context match output. From Abhinav Upadhyay in PR 49058. --- usr.sbin/makemandb/apropos-utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/makemandb/apropos-utils.c b/usr.sbin/makemandb/apropos-utils.c index 535941520e78..b5951707e3d7 100644 --- a/usr.sbin/makemandb/apropos-utils.c +++ b/usr.sbin/makemandb/apropos-utils.c @@ -1,4 +1,4 @@ -/* $NetBSD: apropos-utils.c,v 1.15 2013/04/02 17:16:50 christos Exp $ */ +/* $NetBSD: apropos-utils.c,v 1.16 2014/08/01 12:55:00 wiz Exp $ */ /*- * Copyright (c) 2011 Abhinav Upadhyay * All rights reserved. @@ -31,7 +31,7 @@ */ #include -__RCSID("$NetBSD: apropos-utils.c,v 1.15 2013/04/02 17:16:50 christos Exp $"); +__RCSID("$NetBSD: apropos-utils.c,v 1.16 2014/08/01 12:55:00 wiz Exp $"); #include #include @@ -704,9 +704,9 @@ callback_html(void *data, const char *section, const char *name, break; } } - qsnippet[++i] = 0; + qsnippet[i] = 0; (*callback)(orig_data->data, section, name, name_desc, - (const char *)qsnippet, qsnippet_length); + (const char *)qsnippet, strlen(qsnippet)); free(qsnippet); return 0; }