From: Shawn O. Pearce Date: Sun, 29 Apr 2007 00:01:27 +0000 (-0400) Subject: Don't allow empty pathnames in fast-import X-Git-Tag: v1.5.1.3~11^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=475d1b333a03b0c13cbbc4ebf395fe11c989f931;p=git.git 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 --- diff --git a/fast-import.c b/fast-import.c index cdd629d6b..6c43a0d37 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];