mirror of
https://github.com/git/git.git
synced 2024-11-24 02:17:02 +08:00
Don't allow empty pathnames in fast-import
riddochc on #git noticed corruption caused by import-tars. This was fixed in the prior commit by Dscho, but fast-import was wrong to have allowed a tree to be created with an empty string as the filename. No operating system allows this, and Git itself doesn't accept this into the index. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
87859f3443
commit
475d1b333a
@ -1193,6 +1193,8 @@ static int tree_content_set(
|
||||
n = slash1 - p;
|
||||
else
|
||||
n = strlen(p);
|
||||
if (!n)
|
||||
die("Empty path component found in input");
|
||||
|
||||
for (i = 0; i < t->entry_count; i++) {
|
||||
e = t->entries[i];
|
||||
|
Loading…
Reference in New Issue
Block a user