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

[PATCH 0/2] Fix possible buffer overflow in remove_subtree()

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Mar 13, 2014, 09:19 UTC
Message-ID
<1394702348-6433-1-git-send-email-mhagger@alum.mit.edu>

These patches are proposed for maint (but also apply cleanly to master).

I presume that this is exploitable via Git commands, though I haven't verified it explicitly [1].

I *think* that the rest of the file is OK. open_output_fd() initially looks suspicious, because it strcpy()s a string onto the end of its path argument. But that is only done when to_tempfile is set, which in turn is handled consistently up the callstack up to the point where it is initially set in checkout_entry() if topath is not NULL. So as long as the caller obeys checkout_entry()'s docstring and passes a long enough buffer for topath, I think everything is OK. In any case, the string appended in open_output_fd() is not under the control of the user, so even if there were a bug in this code path it shouldn't be exploitable.

[1] For example, it is conceivable that there are some checks when
    writing a tree that prevent files with such long names from being
    written by Git.  But even if so, it is clearly a bug that could be
    hit locally on any filesystem where PATH_MAX is not a hard limit.
Michael Haggerty (2):
  checkout_entry(): use the strbuf throughout the function
  entry.c: fix possible buffer overflow in remove_subtree()
 entry.c | 64 ++++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 32 insertions(+), 32 deletions(-)
-- 
1.9.0
Next: Michael Haggerty
Message 1 of 6 in “Fix possible buffer overflow in remove_subtree()”
  1. 0/2 Fix possible buffer overflow in remove_subtree()Michael Haggerty, Mar 13, 2014
  2. 1/2 checkout_entry(): use the strbuf throughout the functionMichael Haggerty, Mar 13, 2014
  3. Duy NguyenMar 13, 2014
  4. 2/2 entry.c: fix possible buffer overflow in remove_subtree()Michael Haggerty, Mar 13, 2014
  5. Duy NguyenMar 13, 2014
  6. Jeff KingMar 13, 2014

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.