git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] pretty: avoid buffer overflow in format_person_part
Date: Tue, 22 May 2012 13:53:57 -0700	[thread overview]
Message-ID: <7vy5ok2aze.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20120522054508.GA10576@sigill.intra.peff.net> (Jeff King's message of "Tue, 22 May 2012 01:45:08 -0400")

Jeff King <peff@peff.net> writes:

> A more ideal solution would be for mailmap to grow an
> interface that:
>
>   1. Takes a pointer and length combination, instead of
>      assuming a NUL-terminated string.
>
>   2. Returns a pointer to the mailmap's allocated string,
>      rather than copying it into the buffer.

I was looking at René's patch to refs codepath that converted some "we
allocate because callee wants to have NUL-terminated strings" functions to
take counted strings (or whatever we want to call it---perhaps "string
slices"?), and it appears that we may benefit if more callers that do not
have to own strings that comes to them used them instead of NUL-terminated
strings as their interface.  At some deep point near the leaf of the
callchain, they may need to be converted in order to call external API
(read: POSIX) that takes NUL-terminated strings, but internal callchain
like the mailmap one, if done carefully, should let us avoid extra
allocations.

      reply	other threads:[~2012-05-22 20:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-22  5:45 [PATCH] pretty: avoid buffer overflow in format_person_part Jeff King
2012-05-22 20:53 ` Junio C Hamano [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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vy5ok2aze.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).