提交 8c5acfb9 编写于 作者: J Jeff King 提交者: Junio C Hamano

transport-helper: replace checked snprintf with xsnprintf

We can use xsnprintf to do our truncation check with less
code. The error message isn't as specific, but the point is
that this isn't supposed to trigger in the first place
(because our buffer is big enough to handle any int).
Signed-off-by: NJeff King <peff@peff.net>
上级 1a168e5c
......@@ -347,14 +347,11 @@ static int set_helper_option(struct transport *transport,
static void standard_options(struct transport *t)
{
char buf[16];
int n;
int v = t->verbose;
set_helper_option(t, "progress", t->progress ? "true" : "false");
n = snprintf(buf, sizeof(buf), "%d", v + 1);
if (n >= sizeof(buf))
die("impossibly large verbosity value");
xsnprintf(buf, sizeof(buf), "%d", v + 1);
set_helper_option(t, "verbosity", buf);
switch (t->family) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册