Skip to content

Commit

Permalink
compat/hstrerror: convert sprintf to snprintf
Browse files Browse the repository at this point in the history
This is a trivially correct use of sprintf, as our error
number should not be excessively long. But it's still nice
to drop an sprintf call.

Note that we cannot use xsnprintf here, because this is
compat code which does not load git-compat-util.h.

Signed-off-by: Jeff King <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
peff authored and gitster committed Sep 25, 2015
1 parent f5691aa commit 48bdf86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compat/hstrerror.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ const char *githstrerror(int err)
case TRY_AGAIN:
return "Non-authoritative \"host not found\", or SERVERFAIL";
}
sprintf(buffer, "Name resolution error %d", err);
snprintf(buffer, sizeof(buffer), "Name resolution error %d", err);
return buffer;
}

0 comments on commit 48bdf86

Please sign in to comment.