git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Schuberth <sschuberth@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] blame.c: Properly initialize strbuf after calling textconv_object(), again
Date: Mon, 07 Nov 2011 18:31:23 +0100	[thread overview]
Message-ID: <4EB815EB.30702@gmail.com> (raw)
In-Reply-To: <7vy5vr282s.fsf@alter.siamese.dyndns.org>

On 07.11.2011 17:47, Junio C Hamano wrote:

>> 2564aa4 started to initialize buf.alloc, but that should actually be one
>> more byte than the string length due to the trailing \0.
>
> Even when the conversion result is a zero-length string?

In this case, yes. The string buffer is initialized (and detached) in 
run_textconv, which calls strbuf_read, which grows the (yet empty) 
string to 8192 bytes. So alloc is always > 0, and the detach will trim 
alloc to len + 1.

However, Peff made another valid point and I'll send v2 soon.

-- 
Sebastian Schuberth

  reply	other threads:[~2011-11-07 17:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07 15:53 [PATCH] blame.c: Properly initialize strbuf after calling textconv_object(), again Sebastian Schuberth
2011-11-07 16:47 ` Junio C Hamano
2011-11-07 17:31   ` Sebastian Schuberth [this message]
2011-11-07 16:49 ` Jeff King
2011-11-07 17:33   ` [PATCHv2] " Sebastian Schuberth
2011-11-07 17:41     ` Jeff King

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=4EB815EB.30702@gmail.com \
    --to=sschuberth@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 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).