Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/makemandb Fix an off by one bug in apropos.



details:   https://anonhg.NetBSD.org/src/rev/05c5e9000135
branches:  trunk
changeset: 331114:05c5e9000135
user:      wiz <wiz%NetBSD.org@localhost>
date:      Fri Aug 01 12:55:00 2014 +0000

description:
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.

diffstat:

 usr.sbin/makemandb/apropos-utils.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r c8b4d774fa62 -r 05c5e9000135 usr.sbin/makemandb/apropos-utils.c
--- a/usr.sbin/makemandb/apropos-utils.c        Fri Aug 01 05:53:31 2014 +0000
+++ b/usr.sbin/makemandb/apropos-utils.c        Fri Aug 01 12:55:00 2014 +0000
@@ -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@localhost>
  * 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 @@
                        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;
 }



Home | Main Index | Thread Index | Old Index