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.
This commit is contained in:
wiz 2014-08-01 12:55:00 +00:00
parent caf15fb7f4
commit fc7115c3f4
1 changed files with 4 additions and 4 deletions

View File

@ -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 <er.abhinav.upadhyay@gmail.com>
* All rights reserved.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__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 <sys/queue.h>
#include <sys/stat.h>
@ -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;
}