]> git.ipfire.org Git - thirdparty/git.git/blobdiff - archive-tar.c
archive-tar: split long paths more carefully
[thirdparty/git.git] / archive-tar.c
index 20af0051a334a1357b055ea10d74f5380117ab68..9d4eec2c71ed703fcb5e6df4cfed200b219e1e2e 100644 (file)
@@ -115,6 +115,8 @@ static unsigned int ustar_header_chksum(const struct ustar_header *header)
 static size_t get_path_prefix(const char *path, size_t pathlen, size_t maxlen)
 {
        size_t i = pathlen;
+       if (i > 1 && path[i - 1] == '/')
+               i--;
        if (i > maxlen)
                i = maxlen;
        do {