Commit f5691aa6 authored by Jeff King's avatar Jeff King Committed by Junio C Hamano

stop_progress_msg: convert sprintf to xsnprintf

The usual arguments for using xsnprintf over sprintf apply,
but this case is a little tricky. We print to a fixed-size
buffer if we have room, and otherwise to an allocated
buffer. So there should be no overflow here, but it is still
good to communicate our intention, as well as to check our
earlier math for how much space the string will need.
Signed-off-by: default avatarJeff King <>
Signed-off-by: default avatarJunio C Hamano <>
parent c3bb0ac7
......@@ -254,7 +254,7 @@ void stop_progress_msg(struct progress **p_progress, const char *msg)
throughput_string(&tp->display, tp->curr_total, rate);
progress_update = 1;
sprintf(bufp, ", %s.\n", msg);
xsnprintf(bufp, len + 1, ", %s.\n", msg);
display(progress, progress->last_value, bufp);
if (buf != bufp)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment