GNU bug report logs - #21611
probable bug in tee: tee overwrites argv[argc] (coreutils-8.24)

Previous Next

Package: coreutils;

Reported by: Rainer Deyke <rainerd <at> eldwood.com>

Date: Sat, 3 Oct 2015 13:25:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21611 in the body.
You can then email your comments to 21611 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#21611; Package coreutils. (Sat, 03 Oct 2015 13:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rainer Deyke <rainerd <at> eldwood.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sat, 03 Oct 2015 13:25:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rainer Deyke <rainerd <at> eldwood.com>
To: bug-coreutils <at> gnu.org
Subject: probable bug in tee: tee overwrites argv[argc] (coreutils-8.24)
Date: Sat, 3 Oct 2015 11:48:59 +0200
[Message part 1 (text/plain, inline)]
As mentioned in a comment on line 198 of 'tee.c', 'tee' overwrites 
'argv[argc]'.  This is very bad style at best, and probably undefined 
behavior on at least some platforms.  The attached patch replaces the 
current hack with another hack that is still bad style, but probably 
safer than the current hack.


-- 
Rainer Deyke (rainerd <at> eldwood.com)
[patch (text/plain, attachment)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Sun, 04 Oct 2015 00:07:03 GMT) Full text and rfc822 format available.

Notification sent to Rainer Deyke <rainerd <at> eldwood.com>:
bug acknowledged by developer. (Sun, 04 Oct 2015 00:07:03 GMT) Full text and rfc822 format available.

Message #10 received at 21611-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Rainer Deyke <rainerd <at> eldwood.com>, 21611-done <at> debbugs.gnu.org
Subject: Re: bug#21611: probable bug in tee: tee overwrites argv[argc]
 (coreutils-8.24)
Date: Sat, 3 Oct 2015 17:06:52 -0700
[Message part 1 (text/plain, inline)]
Rainer Deyke wrote:
> As mentioned in a comment on line 198 of 'tee.c', 'tee' overwrites
> 'argv[argc]'.  This is very bad style at best, and probably undefined behavior
> on at least some platforms.

Thanks for the report.  It's well-defined behavior on any platform conforming to 
the C standard, so it should be quite safe.  That being said, it's a bit faster 
to subtract 1 from a pointer than to do the equivalent of a memmove of an array, 
so it sounds a bit faster to do things the way you suggest.  Cleaner, too.  I 
installed the attached patch.
[0001-tee-simplify-argv-handling.patch (text/plain, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 01 Nov 2015 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 231 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.