git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/3] validate_headref: avoid reading uninitialized bytes
@ 2017-09-27  6:16 Jeff King
  2017-09-27  6:17 ` [PATCH 1/3] validate_headref: NUL-terminate HEAD buffer Jeff King
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jeff King @ 2017-09-27  6:16 UTC (permalink / raw)
  To: git

While looking at read_in_full() callers for a nearby patch series, I
noticed this fairly harmless bug. The first patch fixes it, and the
other two do some cleanups on top.

I'm tempted to say the whole thing ought to just use a strbuf. We
typically only call this function once per program, and git HEAD files
are small enough not to worry about. On the other hand, the point of the
function is to see if this is in fact a git repository. So in the rare
case that we see a file named ".git/HEAD" that's actually a 2GB video
file, we'd prefer to find out after reading only 256 bytes, not the
whole thing.

  [1/3]: validate_headref: NUL-terminate HEAD buffer
  [2/3]: validate_headref: use skip_prefix for symref parsing
  [3/3]: validate_headref: use get_oid_hex for detached HEADs

 path.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

-Peff

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-09-27  7:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-27  6:16 [PATCH 0/3] validate_headref: avoid reading uninitialized bytes Jeff King
2017-09-27  6:17 ` [PATCH 1/3] validate_headref: NUL-terminate HEAD buffer Jeff King
2017-09-27  7:06   ` Junio C Hamano
2017-09-27  7:16     ` Jeff King
2017-09-27  7:28       ` Junio C Hamano
2017-09-27  6:17 ` [PATCH 2/3] validate_headref: use skip_prefix for symref parsing Jeff King
2017-09-27  7:07   ` Junio C Hamano
2017-09-27  6:17 ` [PATCH 3/3] validate_headref: use get_oid_hex for detached HEADs Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).