Skip to content

Commit

Permalink
Don't allow empty pathnames in fast-import
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce committed Apr 29, 2007
1 parent 87859f3 commit 475d1b3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 475d1b3

Please sign in to comment.