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>
This commit is contained in:
Jeff King 2015-09-24 17:06:48 -04:00 коммит произвёл Junio C Hamano
Родитель f5691aa640
Коммит 48bdf86995
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -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;
}