@matheusbsbs / matheus-bagliano / commits / 475d1b333a
Fork 0

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>

Shawn O. Pearce committed Apr 28, 2007 at 20:01 UTC 475d1b333a03b0c13cbbc4ebf395fe11c989f931
1 file changed +2
fast-import.c
+2
@@ -1193,6 +1193,8 @@ static int tree_content_set(
1193 n = slash1 - p;
1194 else
1195 n = strlen(p);
1196 + if (!n)
1197 + die("Empty path component found in input");
1198
1199 for (i = 0; i < t->entry_count; i++) {
1200 e = t->entries[i];