emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#21611: closed (probable bug in tee: tee overwrites


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#21611: closed (probable bug in tee: tee overwrites argv[argc] (coreutils-8.24))
Date: Sun, 04 Oct 2015 00:07:03 +0000

Your message dated Sat, 3 Oct 2015 17:06:52 -0700
with message-id <address@hidden>
and subject line Re: bug#21611: probable bug in tee: tee overwrites argv[argc] 
(coreutils-8.24)
has caused the debbugs.gnu.org bug report #21611,
regarding probable bug in tee: tee overwrites argv[argc] (coreutils-8.24)
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
21611: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21611
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: probable bug in tee: tee overwrites argv[argc] (coreutils-8.24) Date: Sat, 3 Oct 2015 11:48:59 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 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 (address@hidden)

Attachment: patch
Description: Text document


--- End Message ---
--- Begin Message --- Subject: Re: bug#21611: probable bug in tee: tee overwrites argv[argc] (coreutils-8.24) Date: Sat, 3 Oct 2015 17:06:52 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0
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.

Attachment: 0001-tee-simplify-argv-handling.patch
Description: Text document


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]