All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] worktree: Fix out of bounds read that causes data loss and reject invalid empty input in worktree add
@ 2026-07-25 11:19 Matthias Aßhauer via GitGitGadget
  2026-07-25 11:19 ` [PATCH 1/2] worktree: don't read out of bounds Matthias Aßhauer via GitGitGadget
  2026-07-25 11:19 ` [PATCH 2/2] worktree: reject empty string Matthias Aßhauer via GitGitGadget
  0 siblings, 2 replies; 4+ messages in thread
From: Matthias Aßhauer via GitGitGadget @ 2026-07-25 11:19 UTC (permalink / raw)
  To: git
  Cc: Marc Branchaud, Nguyễn Thái Ngọc Duy,
	Eric Sunshine, Matthias Aßhauer

Passing an empty string to git worktree add (typically via an unset
variable, e.g. git worktree add "$UNSET_VAR" -b tb origin/main) can result
in BUG: How come '' becomes empty after sanitization? but it can also have
worse consequences: recursively deleting the current working directory,
including .git. The inconsistent behaviour is caused by worktree_basename
reading unrelated bytes from the memory before path and passing that back to
add_worktree, which can circumvent the check for the BUG call.

Matthias Aßhauer (2):
  worktree: don't read out of bounds
  worktree: reject empty string

 builtin/worktree.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)


base-commit: 9a0c4701dcd5725c4184599322b52933ff5005ca
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2187%2Frimrul%2Fworktree-fix-oob-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2187/rimrul/worktree-fix-oob-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2187
-- 
gitgitgadget

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

end of thread, other threads:[~2026-07-25 16:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-25 11:19 [PATCH 0/2] worktree: Fix out of bounds read that causes data loss and reject invalid empty input in worktree add Matthias Aßhauer via GitGitGadget
2026-07-25 11:19 ` [PATCH 1/2] worktree: don't read out of bounds Matthias Aßhauer via GitGitGadget
2026-07-25 16:51   ` Junio C Hamano
2026-07-25 11:19 ` [PATCH 2/2] worktree: reject empty string Matthias Aßhauer via GitGitGadget

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.