From: Junio C Hamano <gitster@pobox•com>
To: Michael Haggerty <mhagger@alum•mit.edu>
Cc: Mark Levedahl <mlevedahl@gmail•com>, git@vger•kernel.org
Subject: Re: regression in git-gui since 2c5c66b... Merge branch 'jp/get-ref-dir-unsorted
Date: Mon, 17 Oct 2011 10:22:47 -0700 [thread overview]
Message-ID: <7v4nz7o7mg.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <4E9C2F3C.7080405@alum.mit.edu> (Michael Haggerty's message of "Mon, 17 Oct 2011 15:35:56 +0200")
Michael Haggerty <mhagger@alum•mit.edu> writes:
> static int resolve_gitlink_packed_ref(char *name, int pathlen, const
> char *refname, unsigned char *result)
> {
> int retval = -1;
> struct ref_entry *ref;
> struct ref_array *array = get_packed_refs(name);
>
> ref = search_ref_array(array, refname);
> if (ref != NULL) {
> memcpy(result, ref->sha1, 20);
> retval = 0;
> }
> return retval;
> }
>
> The problem is that the parameter "name" is not NUL-terminated. The old
> code turned it into a (NUL-terminated) filename via
>
> strcpy(name + pathlen, "packed-refs");
>
> but the new code passes it (unterminated) to get_packed_refs()
Thanks for digging this through before I got to it. Very much appreciated,
and sorry or the mismerge (incidentally this was why I wanted to merge
early these two topics that tried to improve different things that
happened to touch the same part of the code, as I knew such a merge was
risky and needed plenty time before it hits released versions).
next prev parent reply other threads:[~2011-10-17 17:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-16 18:10 regression in git-gui since 2c5c66b... Merge branch 'jp/get-ref-dir-unsorted Mark Levedahl
2011-10-17 0:35 ` Junio C Hamano
2011-10-17 1:38 ` Mark Levedahl
2011-10-17 3:40 ` Michael Haggerty
2011-10-17 10:07 ` Mark Levedahl
2011-10-17 13:35 ` Michael Haggerty
2011-10-17 13:55 ` Jeff King
2011-10-17 17:22 ` Junio C Hamano [this message]
2011-10-17 18:43 ` [PATCH] resolve_gitlink_packed_ref(): fix mismerge Junio C Hamano
2011-10-17 22:12 ` Mark Levedahl
2011-10-17 23:14 ` Junio C Hamano
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=7v4nz7o7mg.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=mhagger@alum$(echo .)mit.edu \
--cc=mlevedahl@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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