All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
To: Junio C Hamano <gitster@pobox.com>
Cc: Bill Lear <rael@zopyra.com>, git@vger.kernel.org
Subject: Re: [PATCH 1/4] Add xmallocz()
Date: Tue, 26 Jan 2010 23:13:48 +0200	[thread overview]
Message-ID: <20100126211347.GA9194@Knoppix> (raw)
In-Reply-To: <7vwrz4y4gf.fsf@alter.siamese.dyndns.org>

On Tue, Jan 26, 2010 at 12:52:00PM -0800, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > I'd rather see the function lose the NUL termination; if that makes the
> > behaviour inconsistent with its name, perhaps it is better to rename the
> > function; perhaps xmalloc1() to denote that it overallocates by one?
> 
> Actually I take that back---all the callers do benefit from the allocator
> giving a buffer that is pre-terminated with NUL.
> 
> We can also lose "buf[size] = 0" from unpack_sha1_rest() patch.

If that line would be next to xmalloc() line, I would have removed it, but
because it was beyound loop, I was worried that something might be done
to it (and was not in right mood to analyze the logic properly).

And yeah, that nul-termination in xmemdupz is not needed. Oops, missed
that.

-Ilari

  reply	other threads:[~2010-01-26 21:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-26 18:24 [PATCH 0/4] Fix various integer overflows Ilari Liusvaara
2010-01-26 18:24 ` [PATCH 1/4] Add xmallocz() Ilari Liusvaara
2010-01-26 20:37   ` Bill Lear
2010-01-26 20:47     ` Junio C Hamano
2010-01-26 20:52       ` Junio C Hamano
2010-01-26 21:13         ` Ilari Liusvaara [this message]
2010-01-26 20:56       ` Bill Lear
2010-01-26 18:24 ` [PATCH 2/4] Fix integer overflow in patch_delta() Ilari Liusvaara
2010-01-26 18:24 ` [PATCH 3/4] Fix integer overflow in unpack_sha1_rest() Ilari Liusvaara
2010-01-26 18:24 ` [PATCH 4/4] Fix integer overflow in unpack_compressed_entry() Ilari Liusvaara
2010-01-26 19:58 ` [PATCH 0/4] Fix various integer overflows Junio C Hamano
2010-01-27  8:59   ` Stephen R. van den Berg
2010-01-27  9:57     ` Ilari Liusvaara

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=20100126211347.GA9194@Knoppix \
    --to=ilari.liusvaara@elisanet.fi \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=rael@zopyra.com \
    /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.