NetBSD Problem Report #49058
From www@NetBSD.org Fri Aug 1 12:43:55 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 16409A895C
for <gnats-bugs@gnats.NetBSD.org>; Fri, 1 Aug 2014 12:43:55 +0000 (UTC)
Message-Id: <20140801124353.C1A7AA895D@mollari.NetBSD.org>
Date: Fri, 1 Aug 2014 12:43:53 +0000 (UTC)
From: er.abhinav.upadhyay@gmail.com
Reply-To: er.abhinav.upadhyay@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Off by one bug in apropos
X-Send-Pr-Version: www-1.0
>Number: 49058
>Category: bin
>Synopsis: Off by one bug in apropos
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Aug 01 12:45:00 +0000 2014
>Closed-Date: Fri Aug 01 12:55:16 +0000 2014
>Last-Modified: Fri Aug 01 13:00:00 +0000 2014
>Originator: Abhinav Upadhyay
>Release: NetBSD-6
>Organization:
>Environment:
>Description:
I noticed 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.
>How-To-Repeat:
apropos -n 1 -h ls
<tr><td colspan=2>lsr</td></tr>
(notice the extra 'r' after )
apropos -n 1 -h cp
<tr><td colspan=2>cpo</td></tr>
(notice the 'o' after )
>Fix:
Index: apropos-utils.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/makemandb/apropos-utils.c,v
retrieving revision 1.15
diff -u -r1.15 apropos-utils.c
--- apropos-utils.c 2 Apr 2013 17:16:50 -0000 1.15
+++ apropos-utils.c 27 Jul 2014 16:26:26 -0000
@@ -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;
}
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Fri, 01 Aug 2014 12:55:16 +0000
State-Changed-Why:
Committed, thanks.
From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49058 CVS commit: src/usr.sbin/makemandb
Date: Fri, 1 Aug 2014 12:55:00 +0000
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.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.