aboutsummaryrefslogtreecommitdiff
path: root/compat/hstrerror.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-09-24 17:06:48 -0400
committerJunio C Hamano <gitster@pobox.com>2015-09-25 10:18:18 -0700
commit48bdf86995423736f36557d744841b08c8bf4e14 (patch)
treee3e5ca3016f91925268274e282905db44875a196 /compat/hstrerror.c
parentf5691aa640ae2c1c5f85037e093de7f310c0eac7 (diff)
downloadgit-48bdf86995423736f36557d744841b08c8bf4e14.tar.gz
git-48bdf86995423736f36557d744841b08c8bf4e14.tar.xz
compat/hstrerror: convert sprintf to snprintf
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/hstrerror.c')
-rw-r--r--compat/hstrerror.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/hstrerror.c b/compat/hstrerror.c
index 069c555da..b85a2fa95 100644
--- a/compat/hstrerror.c
+++ b/compat/hstrerror.c
@@ -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;
}