Re: [PATCH 03/10] builtin/tag.c: convert trivial snprintf calls to xsnprintf
- From
Jeff King <peff@peff.net>
- Date
- Jun 3, 2016, 08:52 UTC
- Message-ID
- <20160603085231.GB28401@sigill.intra.peff.net>
- In-Reply-To
- <20160603074724.12173-3-gitter.spiros@gmail.com>
On Fri, Jun 03, 2016 at 07:47:17AM +0000, Elia Pinto wrote:
Show 16 quoted lines
> builtin/tag.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/tag.c b/builtin/tag.c
> index 50e4ae5..0345ca3 100644
> --- a/builtin/tag.c
> +++ b/builtin/tag.c
> @@ -225,7 +225,7 @@ static void create_tag(const unsigned char *object, const char *tag,
> if (type <= OBJ_NONE)
> die(_("bad object type."));
>
> - header_len = snprintf(header_buf, sizeof(header_buf),
> + header_len = xsnprintf(header_buf, sizeof(header_buf),
> "object %s\n"
> "type %s\n"
> "tag %s\n"This is another of my "type 2" cases. I'd argue it should be using a heap buffer to handle tag and tagger names of arbitrary size.
-Peff