All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Martin Koegler <martin.koegler@chello.at>
Cc: git@vger.kernel.org, Johannes.Schindelin@gmx.de
Subject: Re: [Patch size_t V3 17/19] Convert ref-filter to size_t
Date: Thu, 17 Aug 2017 11:03:13 -0700	[thread overview]
Message-ID: <xmqqmv6ygjha.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1502914591-26215-18-git-send-email-martin@mail.zuhause> (Martin Koegler's message of "Wed, 16 Aug 2017 22:16:29 +0200")

Martin Koegler <martin.koegler@chello.at> writes:

> -static char *copy_subject(const char *buf, unsigned long len)
> +static char *copy_subject(const char *buf, size_t len)
>  {
>  	char *r = xmemdupz(buf, len);
>  	int i;

This has the same "we are still iterating with 'int i' over an array
that can be 'size_t len' long" issue as I pointed out in 19/19.  The
remedy is similar, i.e.

	static char *copy_subject(const char *buf, size_t len)
	{
		char *ret = xmemdupz(buf, len);
		char *cp;

		for (cp = ret; cp < ret + len; cp++)
			if (*cp == '\n')
				*cp = ' ';
		return ret;
	}

which should come either before the whole series or after the series
settles, not inside this series.

I do also wonder if we want to do more for other control characters
(e.g. CR, HT, etc.) in this function, though.  That is totally outside
the scope of this series and should be done independently.

> @@ -898,7 +898,7 @@ static void grab_date(const char *buf, struct atom_value *v, const char *atomnam
>  }
>  
>  /* See grab_values */
> -static void grab_person(const char *who, struct atom_value *val, int deref, struct object *obj, void *buf, unsigned long sz)
> +static void grab_person(const char *who, struct atom_value *val, int deref, struct object *obj, void *buf, size_t sz)
>  {
>  	int i;
>  	int wholen = strlen(who);

Shouldn't this also become size_t, I wonder?

I did not see anything fishy in the remaining parts I did not
comment on.

Thanks.

  reply	other threads:[~2017-08-17 18:03 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-16 20:16 [Patch size_t V3 00/19] use size_t Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 01/19] delta: fix enconding size larger than an "uint" can hold Martin Koegler
2017-08-17 20:28   ` Torsten Bögershausen
2017-08-16 20:16 ` [Patch size_t V3 02/19] Convert size datatype to size_t Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 03/19] Convert zlib.c " Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 04/19] delta: Fix offset overflows Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 05/19] Convert sha1_file.c to size_t Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 06/19] Use size_t for sha1 Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 07/19] Convert parse_X_buffer to size_t Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 08/19] Convert fsck.c & commit.c " Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 09/19] Convert cache functions " Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 10/19] Add overflow check to get_delta_hdr_size Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 11/19] Use size_t for config parsing Martin Koegler
2017-08-24 20:29   ` Johannes Sixt
2017-08-16 20:16 ` [Patch size_t V3 12/19] Convert pack-objects to size_t Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 13/19] Convert index-pack " Martin Koegler
2017-08-16 21:42   ` Ramsay Jones
2017-08-16 20:16 ` [Patch size_t V3 14/19] Convert unpack-objects " Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 15/19] Convert archive functions " Martin Koegler
2017-08-21  6:42   ` Junio C Hamano
2017-08-22  1:19     ` brian m. carlson
2017-08-16 20:16 ` [Patch size_t V3 16/19] Convert various things " Martin Koegler
2017-08-21  6:34   ` Junio C Hamano
2017-08-16 20:16 ` [Patch size_t V3 17/19] Convert ref-filter " Martin Koegler
2017-08-17 18:03   ` Junio C Hamano [this message]
2017-08-17 18:04     ` Junio C Hamano
2017-08-16 20:16 ` [Patch size_t V3 18/19] Convert tree-walk " Martin Koegler
2017-08-17 17:53   ` Junio C Hamano
2017-08-16 20:16 ` [Patch size_t V3 19/19] Convert xdiff-interface " Martin Koegler
2017-08-17 17:49   ` Junio C Hamano
2017-08-16 21:33 ` [Patch size_t V3 00/19] use size_t Junio C Hamano
2017-08-17 20:35 ` Torsten Bögershausen
2017-08-18  7:08   ` Martin Koegler

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=xmqqmv6ygjha.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=martin.koegler@chello.at \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.