Directory traversal bugs
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v5 Latest8 patches 0 repliesNew
- v48 patches 7 repliesSuperseded
- v33 patches 3 repliesSuperseded
Earlier versions · 2
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v2 | 8 patches | 15 replies | Superseded | |
| v1 | 8 patches | 4 replies | Superseded |
Changes in v5 from the cover letter
* added a comment with the rationale for allocating an extra len+1 bytes for the dirent.
Patches in v5 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | t3011: demonstrate directory traversal failurest/ | +209 | 0 replies | |
| 2/8 | Revert "dir.c: make 'git-status --ignored' work within leading directories"dir.c t/ | +7 | 0 replies | |
| 3/8 | dir: remove stray quote character in commentdir.c | +1 | 0 replies | |
| 4/8 | dir: exit before wildcard fall-through if there is no wildcarddir.c t/ | +9 | 0 replies | |
| 5/8 | dir: break part of read_directory_recursive() out for reusedir.c | +37 | 0 replies | |
| 6/8 | dir: fix checks on common prefix directorydir.c t/ | +59 | 0 replies | |
| 7/8 | dir: synchronize treat_leading_path() and read_directory_recursive()dir.c t/ t/ | +32 | 0 replies | |
| 8/8 | dir: consolidate similar code in treat_directory()dir.c | +7 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.
Cover letter [PATCH v5 0/8] Directory traversal bugs
This series documents multiple fill_directory() bugs, and fixes the one that is new to 2.24.0 coming from en/clean-nested-with-ignored-topic, the rest having been around in versions of git going back up to a decade.
Changes since v4:
* added a comment with the rationale for allocating an extra len+1 bytes for the dirent.
Elijah Newren (8):
t3011: demonstrate directory traversal failures
Revert "dir.c: make 'git-status --ignored' work within leading
directories"
dir: remove stray quote character in comment
dir: exit before wildcard fall-through if there is no wildcard
dir: break part of read_directory_recursive() out for reuse
dir: fix checks on common prefix directory
dir: synchronize treat_leading_path() and read_directory_recursive()
dir: consolidate similar code in treat_directory()
dir.c | 187 ++++++++++++---- ...common-prefixes-and-directory-traversal.sh | 209 ++++++++++++++++++ t/t7061-wtstatus-ignore.sh | 9 +- 3 files changed, 354 insertions(+), 51 deletions(-) create mode 100755 t/t3011-common-prefixes-and-directory-traversal.sh
base-commit: da72936f544fec5a335e66432610e4cef4430991
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-676%2Fnewren%2Fls-files-bug-v5
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-676/newren/ls-files-bug-v5
Pull-Request: https://github.com/git/git/pull/676
Range-diff vs v4:
1: 6d659b2302 = 1: 6d659b2302 t3011: demonstrate directory traversal failures
2: 79f2b56174 = 2: 79f2b56174 Revert "dir.c: make 'git-status --ignored' work within leading directories"
3: d6f858cab1 = 3: d6f858cab1 dir: remove stray quote character in comment
4: 8d2d98eec3 = 4: 8d2d98eec3 dir: exit before wildcard fall-through if there is no wildcard
5: d2f5623bd7 = 5: d2f5623bd7 dir: break part of read_directory_recursive() out for reuse
6: 1f3978aa46 ! 6: 97e145489d dir: fix checks on common prefix directory
@@ -93,6 +93,16 @@
if (!len)
return 1;
+
++ /*
++ * We need a manufactured dirent with sufficient space to store a
++ * leading directory component of path in its d_name. Here, we
++ * assume that the dirent's d_name is either declared as
++ * char d_name[BIG_ENOUGH]
++ * or that it is declared at the end of the struct as
++ * char d_name[]
++ * For either case, padding with len+1 bytes at the end will ensure
++ * sufficient storage space.
++ */
+ de = xcalloc(1, sizeof(struct dirent)+len+1);
+ memset(&cdir, 0, sizeof(cdir));
+ cdir.de = de;
7: 542c6e5792 = 7: 5275e6d7f0 dir: synchronize treat_leading_path() and read_directory_recursive()
8: 31079dc1cf = 8: e4768931d0 dir: consolidate similar code in treat_directory()Signature · 1 line
gitgitgadget