diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-12-13 07:33:40 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-12-13 07:33:41 -0800 |
| commit | e56c283c158a517650d770bcc8fd58bdeb8510b8 (patch) | |
| tree | 513e192aefa04568bfd57110d033bf75f2820342 /builtin/fast-import.c | |
| parent | Merge branch 'kh/doc-update-ref-grammofix' (diff) | |
| parent | t9300: test verification of renamed paths (diff) | |
| download | git-e56c283c158a517650d770bcc8fd58bdeb8510b8.tar.gz git-e56c283c158a517650d770bcc8fd58bdeb8510b8.zip | |
Merge branch 'en/fast-import-verify-path'
"git fast-import" learned to reject paths with ".." and "." as
their components to avoid creating invalid tree objects.
* en/fast-import-verify-path:
t9300: test verification of renamed paths
fast-import: disallow more path components
fast-import: disallow "." and ".." path components
Diffstat (limited to 'builtin/fast-import.c')
| -rw-r--r-- | builtin/fast-import.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/fast-import.c b/builtin/fast-import.c index 457cdb40cc..b96217483f 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -13,6 +13,7 @@ #include "delta.h" #include "pack.h" #include "path.h" +#include "read-cache-ll.h" #include "refs.h" #include "csum-file.h" #include "quote.h" @@ -2425,6 +2426,9 @@ static void file_change_m(const char *p, struct branch *b) tree_content_replace(&b->branch_tree, &oid, mode, NULL); return; } + + if (!verify_path(path.buf, mode)) + die("invalid path '%s'", path.buf); tree_content_set(&b->branch_tree, path.buf, &oid, mode, NULL); } @@ -2462,6 +2466,8 @@ static void file_change_cr(const char *p, struct branch *b, int rename) leaf.tree); return; } + if (!verify_path(dest.buf, leaf.versions[1].mode)) + die("invalid path '%s'", dest.buf); tree_content_set(&b->branch_tree, dest.buf, &leaf.versions[1].oid, leaf.versions[1].mode, |
