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

Re: [PATCH] tree-walk: disallow overflowing modes

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 22, 2023, 16:36 UTC
Message-ID
<xmqqk01esf0j.fsf@gitster.g>
In-Reply-To
<044bdc8f-fdc9-dfd2-6cbb-941513467524@web.de>
René Scharfe <l.s.r@web.de> writes:
> We could be more strict and reject everything that oversteps
> S_IFMT|ALLPERMS, but the latter is not defined everywhere.  But
> permission bits are well-known, so the magic number 07777 should be
> recognizable enough.  Like this?

I do not quite see the reason why we want to be more strict than we already are at this point in the code path. Stricter mode check in reports FSCK_MSG_ZERO_PADDED_FILEMODE and FSCK_MSG_BAD_FILEMODE from "fsck", which I think is probably sufficient.

Avoiding integer wraparound is a good idea, even if it were impossible to induce misparsing of the tree data to lead to any security issues, for the same reason why we check for zero padded filemode, i.e. such a tree mode will allow the same tree object to be given different object names.

Thanks.
Previous: René ScharfeNext: Jeff King
Message 4 of 9 in “tree-walk: disallow overflowing modes”
  1. tree-walk: disallow overflowing modesRené Scharfe, Jan 21, 2023
  2. Jeff KingJan 22, 2023
  3. René ScharfeJan 22, 2023
  4. Junio C HamanoJan 22, 2023
  5. Jeff KingJan 22, 2023
  6. Ævar Arnfjörð BjarmasonJan 23, 2023
  7. René ScharfeJan 24, 2023
  8. Junio C HamanoJan 24, 2023
  9. Jeff KingJan 26, 2023

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.