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

Re: git error in tag ...: unterminated header

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jun 25, 2015, 21:07 UTC
Message-ID
<2b124e09d9c89ff3892f246ea91aa3c4@www.dscho.org>
In-Reply-To
<xmqqegkzy1ri.fsf@gitster.dls.corp.google.com>
Hi Junio & Wolfgang,
On 2015-06-25 22:24, Junio C Hamano wrote:
Show 7 quoted lines
> Wolfgang Denk <wd@denx.de> writes:
> 
>> In message <xmqqegkzzoaz.fsf@gitster.dls.corp.google.com> you wrote:
>>>
>>> > Question is: how can we fix that?
>>>
>>> It could be that 4d0d8975 is buggy and barking at a non breakage.
Well, I would like to believe that this commit made our code *safer* by making sure that we would never overrun the buffer. Remember: under certain circumstances, the buffer passed to the fsck machinery is *not* terminated by a NUL. The code I introduced simply verifies that there is an empty line because the fsck code stops there and does not look further.
If the buffer does *not* contain an empty line, the fsck code runs the danger of looking beyond the allocated memory because it uses functions that assume NUL-terminated strings, while the buffer passed to the fsck code is a counted string.
The quick & dirty work-around would be to detect when the buffer does not contain an empty line and to make a NUL-terminated copy in that case.
A better solution was outlined by Peff back when I submitted those patches: change all the code paths that read objects and make sure that all of them are terminated by a NUL. AFAIR some code paths did that already, but not all of them.

Ciao, Dscho

Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 19 in “git error in tag ...: unterminated header”
  1. Wolfgang DenkJun 25, 2015
  2. Junio C HamanoJun 25, 2015
  3. Wolfgang DenkJun 25, 2015
  4. Junio C HamanoJun 25, 2015
  5. Johannes SchindelinJun 25, 2015
  6. Junio C HamanoJun 25, 2015
  7. Junio C HamanoJun 25, 2015
  8. Johannes SchindelinJun 26, 2015
  9. Jeff KingJun 26, 2015
  10. Junio C HamanoJun 26, 2015
  11. Johannes SchindelinJun 27, 2015
  12. Junio C HamanoJun 27, 2015
  13. fsck: it is OK for a tag and a commit to lack the bodyJunio C Hamano, Jun 28, 2015
  14. Eric SunshineJun 28, 2015
  15. Johannes SchindelinJun 29, 2015
  16. Junio C HamanoJun 29, 2015
  17. Johannes SchindelinJun 29, 2015
  18. Junio C HamanoJun 25, 2015
  19. Junio C HamanoJun 25, 2015

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.