git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Ramana Kumar <ramana@member.fsf.org>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: [PATCH 1/3] advice: pass varargs to strbuf_vaddf, not strbuf_addf
Date: Mon, 23 Jul 2012 14:48:57 -0400	[thread overview]
Message-ID: <20120723184857.GA27588@sigill.intra.peff.net> (raw)
In-Reply-To: <20120723184634.GA31905@sigill.intra.peff.net>

The advise() function takes a variable number of arguments
and converts them into a va_list object to pass to strbuf
for handling. However, we accidentally called strbuf_addf
(that takes a variable number of arguments) instead of
strbuf_vaddf (that takes a va_list).

This bug dates back to v1.7.8.1-1-g23cb5bf, but we never
noticed because none of the current callers passes a string
with a format specifier in it. And the compiler did not
notice because the format string is not available at
compile time.

Signed-off-by: Jeff King <peff@peff.net>
---
 advice.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/advice.c b/advice.c
index a492eea..edfbd4a 100644
--- a/advice.c
+++ b/advice.c
@@ -32,7 +32,7 @@ void advise(const char *advice, ...)
 	const char *cp, *np;
 
 	va_start(params, advice);
-	strbuf_addf(&buf, advice, params);
+	strbuf_vaddf(&buf, advice, params);
 	va_end(params);
 
 	for (cp = buf.buf; *cp; cp = np) {
-- 
1.7.10.5.40.g059818d

  reply	other threads:[~2012-07-23 18:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAMej=25=xj61pc+k42dv3byuBqUJzW21Sz+BXwoufqnKwV5Bbg@mail.gmail.com>
2012-07-21 14:26 ` empty ident name trashes commit message Ramana Kumar
2012-07-23 17:27   ` Jeff King
2012-07-23 18:05     ` Ramana Kumar
2012-07-23 18:46     ` Jeff King
2012-07-23 18:48       ` Jeff King [this message]
2012-07-23 18:50       ` [PATCH 2/3] commit: check committer identity more strictly Jeff King
2012-07-23 20:51         ` Junio C Hamano
2012-07-23 20:53           ` Jeff King
2012-07-23 18:52       ` [PATCH 3/3] commit: give a hint when a commit message has been abandoned Jeff King
2012-07-23 20:49         ` Junio C Hamano
2012-07-23 20:52           ` Jeff King
2012-07-23 21:00             ` Junio C Hamano
2012-07-23 21:13               ` Jeff King
2012-07-23 21:35                 ` Junio C Hamano
2012-07-23 21:43                   ` Jeff King
2012-07-23 22:09                     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120723184857.GA27588@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ramana@member.fsf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).