From: Alex Riesen <raa.lkml@gmail.com>
To: Tarmigan Casebolt <tarmigan+git@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Miklos Vajna <vmiklos@frugalware.org>
Subject: Re: [PATCH] Check the format of more printf-type functions
Date: Sun, 15 Nov 2009 15:17:26 +0100 [thread overview]
Message-ID: <81b0412b0911150617x5ef81b1ao9236c49d549ef8ea@mail.gmail.com> (raw)
In-Reply-To: <1258234393-5093-1-git-send-email-tarmigan+git@gmail.com>
On Sat, Nov 14, 2009 at 22:33, Tarmigan Casebolt <tarmigan+git@gmail.com> wrote:
> We already have these checks in many printf-type functions that have
> prototypes which are in header files. Add these same checks to some
> more prototypes in header functions and to static functions in .c
> files.
>
> cc: Miklos Vajna <vmiklos@frugalware.org>
> Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
> ---
>
> Junio, please consider this for next. It will hopefully catch some bugs like
> the Content-Length one in http-backend.c.
>
> One extra warning is
> CC merge-recursive.o
> merge-recursive.c: In function ‘write_tree_from_memory’:
> merge-recursive.c:218: warning: field precision should have type ‘int’, but argument 5 has type ‘size_t’
>
> A fix that might work in practice (because pathnames won't be longer than
> an int?) is:
> --- a/merge-recursive.c
> +++ b/merge-recursive.c
> @@ -215,7 +215,9 @@ struct tree *write_tree_from_memory(struct merge_options *o)
> for (i = 0; i < active_nr; i++) {
> struct cache_entry *ce = active_cache[i];
> if (ce_stage(ce))
> - output(o, 0, "%d %.*s", ce_stage(ce), ce_namelen(ce), ce->name);
> + output(o, 0, "%d %.*s", ce_stage(ce), (int)ce_namelen(ce), ce->name);
It'll do. The message is purely diagnostics.
> + if (ce_namelen(ce) > INT_MAX)
> + die("A filename was too long");
That's overdoing it a little.
prev parent reply other threads:[~2009-11-15 14:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-14 21:33 [PATCH] Check the format of more printf-type functions Tarmigan Casebolt
2009-11-15 1:10 ` Miklos Vajna
2009-11-15 14:17 ` Alex Riesen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=81b0412b0911150617x5ef81b1ao9236c49d549ef8ea@mail.gmail.com \
--to=raa.lkml@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=tarmigan+git@gmail.com \
--cc=vmiklos@frugalware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).