提交 447b99c8 编写于 作者: J Jeff King 提交者: Junio C Hamano

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-g23cb5bf3, 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: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 d0f1ea60
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册