NetBSD Problem Report #47976
From www@NetBSD.org Sun Jun 30 10:43:52 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 5360571739
for <gnats-bugs@gnats.NetBSD.org>; Sun, 30 Jun 2013 10:43:52 +0000 (UTC)
Message-Id: <20130630104351.075E8717B9@mollari.NetBSD.org>
Date: Sun, 30 Jun 2013 10:43:51 +0000 (UTC)
From: henning.petersen@t-online.de
Reply-To: henning.petersen@t-online.de
To: gnats-bugs@NetBSD.org
Subject: Overlapping variables in snprintf.
X-Send-Pr-Version: www-1.0
>Number: 47976
>Category: bin
>Synopsis: Overlapping variables in snprintf.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jun 30 10:45:00 +0000 2013
>Closed-Date: Sun Jul 27 05:20:30 +0000 2014
>Last-Modified: Sun Jul 27 05:20:30 +0000 2014
>Originator: Henning Petersen
>Release: NetBSD-current
>Organization:
>Environment:
>Description:
Scanning sbin, usr.bin and usr.sbin with cppcheck I found 7 in errors.
[sbin/veriexecctl/veriexecctl.c:188]: (error) Undefined behavior: Variable 'fp' is used as parameter and destination in s[n]printf().
[usr.bin/netstat/show.c:734]: (error) Undefined behavior: Variable 'obuf' is used as parameter and destination in s[n]printf().
[usr.bin/tip/cu.c:163]: (error) Undefined behavior: Variable 'brbuf' is used as parameter and destination in s[n]printf().
[usr.bin/tip/tip.c:106]: (error) Undefined behavior: Variable 'brbuf' is used as parameter and destination in s[n]printf().
[usr.sbin/mopd/common/log.c:55]: (error) Undefined behavior: Variable 'buf' is used as parameter and destination in s[n]printf().
[usr.sbin/mopd/common/log.c:72]: (error) Undefined behavior: Variable 'buf' is used as parameter and destination in s[n]printf().
[usr.sbin/schedctl/schedctl.c:298]: (error) Undefined behavior: Variable 'buf' is used as parameter and destination in s[n]printf().
>How-To-Repeat:
>Fix:
n/a
>Release-Note:
>Audit-Trail:
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47976 CVS commit: src/sbin/veriexecctl
Date: Sun, 27 Jul 2014 04:23:44 +0000
Module Name: src
Committed By: dholland
Date: Sun Jul 27 04:23:44 UTC 2014
Modified Files:
src/sbin/veriexecctl: veriexecctl.c
Log Message:
Fix snprintf usage and, while here, don't trundle off the end of an
array. Part of PR 47976 from Henning Petersen.
To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sbin/veriexecctl/veriexecctl.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47976 CVS commit: src/usr.bin/netstat
Date: Sun, 27 Jul 2014 04:26:23 +0000
Module Name: src
Committed By: dholland
Date: Sun Jul 27 04:26:23 UTC 2014
Modified Files:
src/usr.bin/netstat: show.c
Log Message:
Fix snprintf usage; from Henning Petersen in PR 47976.
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/netstat/show.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47976 CVS commit: src/usr.bin/tip
Date: Sun, 27 Jul 2014 04:32:23 +0000
Module Name: src
Committed By: dholland
Date: Sun Jul 27 04:32:23 UTC 2014
Modified Files:
src/usr.bin/tip: cu.c tip.c
Log Message:
Remove broken snprintf usage (noted in PR 47976) and replace with
something simpler.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/tip/cu.c
cvs rdiff -u -r1.54 -r1.55 src/usr.bin/tip/tip.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47976 CVS commit: src/usr.sbin/mopd/common
Date: Sun, 27 Jul 2014 04:38:03 +0000
Module Name: src
Committed By: dholland
Date: Sun Jul 27 04:38:03 UTC 2014
Modified Files:
src/usr.sbin/mopd/common: Makefile log.c
Log Message:
Fix broken snprintf usage; noted in PR 47976 from Henning Petersen.
As a bonus, this removes the nonliteral format arguments.
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/mopd/common/Makefile
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/mopd/common/log.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47976 CVS commit: src/usr.sbin/schedctl
Date: Sun, 27 Jul 2014 04:46:48 +0000
Module Name: src
Committed By: dholland
Date: Sun Jul 27 04:46:48 UTC 2014
Modified Files:
src/usr.sbin/schedctl: schedctl.c
Log Message:
Fix illegal snprintf usage noted in PR 47976 by simplifying it away:
instead of consing up a string and printing it to stdout, just print
to stdout. Not as compositionally tidy, but much simpler and perfectly
adequate here.
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/schedctl/schedctl.c
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: dholland@NetBSD.org
State-Changed-When: Sun, 27 Jul 2014 05:20:30 +0000
State-Changed-Why:
fixed, thanks
>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.