NetBSD Problem Report #35451

From martijnb@atlas.ipv6.stack.nl  Sat Jan 20 21:32:43 2007
Return-Path: <martijnb@atlas.ipv6.stack.nl>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id D19E563BA82
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 20 Jan 2007 21:32:43 +0000 (UTC)
Message-Id: <20070120213733.F166429CC@atlas.ipv6.stack.nl>
Date: Sat, 20 Jan 2007 22:37:33 +0100 (CET)
From: martijnb@atlas.ipv6.stack.nl
Reply-To: martijnb@atlas.ipv6.stack.nl
To: gnats-bugs@NetBSD.org
Subject: devel/cscope is broken (Includes fix)
X-Send-Pr-Version: 3.95

>Number:         35451
>Category:       pkg
>Synopsis:       devel/cscope is broken (Includes fix)
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 20 21:35:00 +0000 2007
>Closed-Date:    Sat Jan 20 23:40:13 +0000 2007
>Last-Modified:  Sat Jan 20 23:40:13 +0000 2007
>Originator:     martijnb@atlas.ipv6.stack.nl
>Release:        NetBSD 4.99.5
>Organization:

>Environment:


System: NetBSD atlas.ipv6.stack.nl 4.99.5 NetBSD 4.99.5 (ATLAS) #0: Sat Dec 2 22:16:36 CET 2006 root@atlas.ipv6.stack.nl:/usr/obj/sys/arch/i386/compile/ATLAS i386
Architecture: i386
Machine: i386
>Description:

  cscope-15.6 is broken, to the point of being completely useless. A simple
  helloworld.c brings it to its knees, causing it to dump core unless cscope
  is called with the -k argument (causing it to skip /usr/include in its
  search path for headerfiles).

  The cause is a security fix backfiring: someone replaced instances of
  sprintf with snprintf, but goofed up in this case: The *arguments* match
  snprintf, but the call still reads sprintf. See Fix.

  I wonder how this managed to slip through. As it's trivially easy to trigger
  this bug, I can't imagine that this has been getting a lot of testing - if
  any at all.

>How-To-Repeat:

  cd /tmp
  echo '#include <stdio.h>' > helloworld.c
  echo 'int main(void) { printf ("Hello world!\n"); return 0; }' >> helloworld.c
  cscope -b

>Fix:

  apply the following patch in /usr/pkgsrc/devel/cscope:

Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/devel/cscope/distinfo,v
retrieving revision 1.16
diff -r1.16 distinfo
12c12
< SHA1 (patch-ah) = 90c3caf336edde19b56b751bac528cf48e0b2e60
---
> SHA1 (patch-ah) = a79523d1a7d685eab31f06085547f91a2fbb01ff
Index: patches/patch-ah
===================================================================
RCS file: /cvsroot/pkgsrc/devel/cscope/patches/patch-ah,v
retrieving revision 1.6
diff -r1.6 patch-ah
54c54
< +	    sprintf(path, sizeof(path), "%.*s/%s",
---
> +	    snprintf(path, sizeof(path), "%.*s/%s",

>Release-Note:

>Audit-Trail:
From: Thomas Klausner <wiz@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/35451 CVS commit: pkgsrc/devel/cscope
Date: Sat, 20 Jan 2007 23:39:45 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	wiz
 Date:		Sat Jan 20 23:39:45 UTC 2007

 Modified Files:
 	pkgsrc/devel/cscope: Makefile distinfo
 	pkgsrc/devel/cscope/patches: patch-ah

 Log Message:
 Fix patch-ah, bump PKGREVISION.
 From martijnb at atlas.ipv6.stack.nl in PR 35451.


 To generate a diff of this commit:
 cvs rdiff -r1.46 -r1.47 pkgsrc/devel/cscope/Makefile
 cvs rdiff -r1.16 -r1.17 pkgsrc/devel/cscope/distinfo
 cvs rdiff -r1.6 -r1.7 pkgsrc/devel/cscope/patches/patch-ah

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

State-Changed-From-To: open->closed
State-Changed-By: wiz@netbsd.org
State-Changed-When: Sat, 20 Jan 2007 23:40:13 +0000
State-Changed-Why:
Committed, thanks.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.