git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: regression in git-gui since 2c5c66b... Merge branch 'jp/get-ref-dir-unsorted

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 17, 2011, 17:22 UTC
Message-ID
<7v4nz7o7mg.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4E9C2F3C.7080405@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
Show 21 quoted lines
> 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).

Previous: Jeff KingNext: Junio C Hamano
Message 8 of 11 in “regression in git-gui since 2c5c66b... Merge branch 'jp/get-ref-dir-unsorted”
  1. Mark LevedahlOct 16, 2011
  2. Junio C HamanoOct 17, 2011
  3. Mark LevedahlOct 17, 2011
  4. Michael HaggertyOct 17, 2011
  5. Mark LevedahlOct 17, 2011
  6. Michael HaggertyOct 17, 2011
  7. Jeff KingOct 17, 2011
  8. Junio C HamanoOct 17, 2011
  9. resolve_gitlink_packed_ref(): fix mismergeJunio C Hamano, Oct 17, 2011
  10. Mark LevedahlOct 17, 2011
  11. Junio C HamanoOct 17, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.