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

Re: [PATCH] Fixed non-literal format in printf-style calls

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Nov 10, 2008, 19:47 UTC
Message-ID
<3t9bmcAj9kThyafdZ9mPENosknipZInn9Qq9u9oVuN7X7qwiI4GqZg@cipher.nrlssc.navy.mil>
In-Reply-To
<1226344517-16120-1-git-send-email-dlowe@bitmuse.com>
Daniel Lowe wrote:
<snip>
Show 11 quoted lines
>  }
> diff --git a/grep.c b/grep.c
> index e2c190a..1db60d9 100644
> --- a/grep.c
> +++ b/grep.c
> @@ -514,7 +514,7 @@ static int grep_buffer_1(struct grep_opt *opt, const char *name,
>  				if (from <= last_shown)
>  					from = last_shown + 1;
>  				if (last_shown && from != last_shown + 1)
> -					printf(hunk_mark);
> +					printf("%s", hunk_mark);
Perhaps these should by changed to use fputs() instead.
<snip>
Show 10 quoted lines
> diff --git a/path.c b/path.c
> index eb24017..ae2c724 100644
> --- a/path.c
> +++ b/path.c
> @@ -41,7 +41,7 @@ char *mksnpath(char *buf, size_t n, const char *fmt, ...)
>  	len = vsnprintf(buf, n, fmt, args);
>  	va_end(args);
>  	if (len >= n) {
> -		snprintf(buf, n, bad_path);
> +		snprintf(buf, n, "%s", bad_path);
and these should use strlcpy.
-brandon
Previous: Daniel LoweNext: Daniel Lowe
Message 2 of 4 in “Fixed non-literal format in printf-style calls”
  1. Fixed non-literal format in printf-style callsDaniel Lowe, Nov 10, 2008
  2. Brandon CaseyNov 10, 2008
  3. Fixed non-literal format in printf-style callsDaniel Lowe, Nov 10, 2008
  4. Junio C HamanoNov 12, 2008

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.