Skip to content

Commit

Permalink
advice: pass varargs to strbuf_vaddf, not strbuf_addf
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Jul 23, 2012
1 parent d0f1ea6 commit 447b99c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion advice.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,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) {
Expand Down

0 comments on commit 447b99c

Please sign in to comment.