summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-04-29 00:01:27 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-04-29 00:03:25 (GMT)
commit475d1b333a03b0c13cbbc4ebf395fe11c989f931 (patch)
tree51c744c0bba019bc329012d9f35e89cab3276920 /fast-import.c
parent87859f34434dda61cabb03447efd1dd2fe7ebac7 (diff)
downloadgit-475d1b333a03b0c13cbbc4ebf395fe11c989f931.zip
git-475d1b333a03b0c13cbbc4ebf395fe11c989f931.tar.gz
git-475d1b333a03b0c13cbbc4ebf395fe11c989f931.tar.bz2
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>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fast-import.c b/fast-import.c
index cdd629d..6c43a0d 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -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];