Git development
 help / color / mirror / Atom feed
From: Jonathan Tan <jonathantanmy@google.com>
To: Maxim Moseychuk <franchesko.salias.hudro.pedros@gmail.com>,
	git@vger.kernel.org
Cc: peff@peff.net
Subject: Re: [PATCH 1/3] add git_psprintf helper function
Date: Thu, 16 Feb 2017 07:51:14 -0800	[thread overview]
Message-ID: <616a2b08-71f9-d594-d46c-2687bf20ae2b@google.com> (raw)
In-Reply-To: <20170216112829.18079-2-franchesko.salias.hudro.pedros@gmail.com>

On 02/16/2017 03:28 AM, Maxim Moseychuk wrote:
> There are a number of places in the code where we call
> xsnprintf(), with the assumption that the output will fit into
> the buffer. If the buffer is small, then git die.
> In many places buffers have compile-time size, but generated string
> depends from current system locale (gettext)and can have size
> greater the buffer.
> Just run "LANG=ru_RU.UTF8 git bisect start v4.9 v4.8"
> on linux sources - it impossible.
>
> git_psprintf is similar to the standard C sprintf() function
> but safer, since it calculates the maximum space required
> and allocates memory to hold the result.
> The returned string should be freed with free() when no longer needed.

If I understand this correctly, xstrfmt (in strbuf.h) should already do 
what you need, so you do not need a new function.

  reply	other threads:[~2017-02-16 15:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 11:28 [PATCH 0/3] Fix l10n Maxim Moseychuk
2017-02-16 11:28 ` [PATCH 1/3] add git_psprintf helper function Maxim Moseychuk
2017-02-16 15:51   ` Jonathan Tan [this message]
2017-02-16 17:03     ` Jeff King
2017-02-16 11:28 ` [PATCH 2/3] bisect_next_all: convert xsnprintf to git_psprintf Maxim Moseychuk
2017-02-16 17:14   ` Jeff King
2017-02-16 11:28 ` [PATCH 3/3] stop_progress_msg: " Maxim Moseychuk
2017-02-16 17:26   ` Jeff King
2017-02-16 17:27 ` [PATCH 0/3] Fix l10n 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=616a2b08-71f9-d594-d46c-2687bf20ae2b@google.com \
    --to=jonathantanmy@google.com \
    --cc=franchesko.salias.hudro.pedros@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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