Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Mike Hommey <mh@glandium.org>
Cc: git@vger.kernel.org
Subject: Re: Ownership handling of the "remote name" buffer given to `remote_get` is inconsistent
Date: Wed, 19 Jun 2024 16:44:50 -0400	[thread overview]
Message-ID: <20240619204450.GA1527089@coredump.intra.peff.net> (raw)
In-Reply-To: <20240619195311.yhmbv5ruixa433rn@glandium.org>

On Thu, Jun 20, 2024 at 04:53:11AM +0900, Mike Hommey wrote:

> When you call `remote_get(name)`, you may end up giving ownership of
> `name` to the remote, such that if you `free(name)`, using the remote
> after that may lead to use-after-free. Of course, this is a
> use-libgit-as-a-library situation; I don't think it happens in actual
> git code.

Try this recent series:

  https://lore.kernel.org/git/20240614102439.GA222287@coredump.intra.peff.net/

especially patches 2 and 3. Junio has it queued as jk/remote-wo-url.
Also, you might want to check the later patches to make sure the
cleanups don't cause any problems for your use case.

-Peff

  reply	other threads:[~2024-06-19 20:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19 19:53 Ownership handling of the "remote name" buffer given to `remote_get` is inconsistent Mike Hommey
2024-06-19 20:44 ` Jeff King [this message]
2024-06-19 21:24   ` Mike Hommey

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=20240619204450.GA1527089@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=mh@glandium.org \
    /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