Re: [PATCH 2/3] Use stringbuf to fix buffer overflows due to broken use of snprintf()
- From
Petr Baudis <pasky@suse.cz>
- Date
- May 22, 2007, 13:43 UTC
- Message-ID
- <20070522134306.GL4489@pasky.or.cz>
- In-Reply-To
- <1179627879.32181.1286.camel@hurina>
On Sun, May 20, 2007 at 04:24:39AM CEST, Timo Sirainen wrote:
Show 6 quoted lines
> @@ -1823,14 +1824,14 @@ static void diff_fill_sha1_info(struct diff_filespec *one)
> static void run_diff(struct diff_filepair *p, struct diff_options *o)
> {
> const char *pgm = external_diff();
> - char msg[PATH_MAX*2+300], *xfrm_msg;
> + stringbuf(msg, PATH_MAX*2+300);I don't find this style of declaring a variable too clear; I think it might be worthwhile to make this stand out more and uppercase the stringbuf() macro.
-- Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ Ever try. Ever fail. No matter. // Try again. Fail again. Fail better. -- Samuel Beckett