Module Name:    src
Committed By:   wiz
Date:           Fri Aug  1 12:55:00 UTC 2014

Modified Files:
        src/usr.sbin/makemandb: apropos-utils.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/makemandb/apropos-utils.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makemandb/apropos-utils.c
diff -u src/usr.sbin/makemandb/apropos-utils.c:1.15 src/usr.sbin/makemandb/apropos-utils.c:1.16
--- src/usr.sbin/makemandb/apropos-utils.c:1.15	Tue Apr  2 17:16:50 2013
+++ src/usr.sbin/makemandb/apropos-utils.c	Fri Aug  1 12:55:00 2014
@@ -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.upadh...@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 *se
 			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;
 }

Reply via email to