--- 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)
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.
0001-tee-simplify-argv-handling.patch
Description: Text document
--- End Message ---