mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00: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;
|
n = slash1 - p;
|
||||||
else
|
else
|
||||||
n = strlen(p);
|
n = strlen(p);
|
||||||
|
if (!n)
|
||||||
|
die("Empty path component found in input");
|
||||||
|
|
||||||
for (i = 0; i < t->entry_count; i++) {
|
for (i = 0; i < t->entry_count; i++) {
|
||||||
e = t->entries[i];
|
e = t->entries[i];
|
||||||
|
|
Loading…
Reference in a new issue