diff options
| author | Thalia Archibald <thalia@archibald.dev> | 2024-04-14 01:12:19 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-04-15 10:06:18 -0700 |
| commit | be4d6a371e80e16ae02d1f258103493394e4c155 (patch) | |
| tree | 86f901d9e76b907f745506e03f97df6a1f763d80 /builtin/fast-import.c | |
| parent | fast-import: document C-style escapes for paths (diff) | |
| download | git-be4d6a371e80e16ae02d1f258103493394e4c155.tar.gz git-be4d6a371e80e16ae02d1f258103493394e4c155.zip | |
fast-import: forbid escaped NUL in paths
NUL cannot appear in paths. Even disregarding filesystem path
limitations, the tree object format delimits with NUL, so such a path
cannot be encoded by Git.
When a quoted path is unquoted, it could possibly contain NUL from
"\000". Forbid it so it isn't truncated.
fast-import still has other issues with NUL, but those will be addressed
later.
Signed-off-by: Thalia Archibald <thalia@archibald.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fast-import.c')
| -rw-r--r-- | builtin/fast-import.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/fast-import.c b/builtin/fast-import.c index 832d0055f9..419ffdcdb5 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -2270,6 +2270,8 @@ static void parse_path(struct strbuf *sb, const char *p, const char **endp, if (*p == '"') { if (unquote_c_style(sb, p, endp)) die("Invalid %s: %s", field, command_buf.buf); + if (strlen(sb->buf) != sb->len) + die("NUL in %s: %s", field, command_buf.buf); } else { /* * Unless we are parsing the last field of a line, |
