git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Timo Sirainen
Message 2 of 2 in “Use stringbuf to fix buffer overflows due to broken use of snprintf()”
  1. 2/3 Use stringbuf to fix buffer overflows due to broken use of snprintf()Timo Sirainen, May 20, 2007
  2. Petr BaudisMay 22, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.