Skip to content

Commit 447b99c

Browse files
peffgitster
authored andcommitted
advice: pass varargs to strbuf_vaddf, not strbuf_addf
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d0f1ea6 commit 447b99c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

advice.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void advise(const char *advice, ...)
2626
const char *cp, *np;
2727

2828
va_start(params, advice);
29-
strbuf_addf(&buf, advice, params);
29+
strbuf_vaddf(&buf, advice, params);
3030
va_end(params);
3131

3232
for (cp = buf.buf; *cp; cp = np) {

0 commit comments

Comments
 (0)