From 79aaee337197e54c5be182bc404a0269bb3b46f6 Mon Sep 17 00:00:00 2001 From: Dave Walton Date: Thu, 20 Jun 2019 09:12:01 -0700 Subject: [PATCH 1/2] Fix MFT -> MTF. --- mtftar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mtftar.c b/mtftar.c index 369b83a..f941207 100644 --- a/mtftar.c +++ b/mtftar.c @@ -250,7 +250,7 @@ int main(int argc, char *argv[]) /* have TAPE header/characteristics */ if (verbose) { str = mtfscan_string(&s, mtfdb_tape_software(&s), '/'); - fprintf(stderr, "MFT Generator: %s\n", str); + fprintf(stderr, "MTF Generator: %s\n", str); free(str); str = mtfscan_string(&s, mtfdb_tape_name(&s), '/'); From 6e2c9598ee5c9a3c54a05a0abab4307c19c2ece4 Mon Sep 17 00:00:00 2001 From: Dave Walton Date: Thu, 20 Jun 2019 09:21:27 -0700 Subject: [PATCH 2/2] Fix path corruption when shortening very long file paths. --- tarout.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tarout.c b/tarout.c index 1f9c548..7d258d3 100644 --- a/tarout.c +++ b/tarout.c @@ -103,15 +103,13 @@ int tarout_heading(struct tar_stream *t, int type, * then chomp up to slash */ pfn_len = i; - for (i = 0; i - pfn_len > 155;) { - for (; i < pfn_len; i++) { - if (filename[i] == '/') { - pfn_len -= (i+1); - } + for (i = 0; pfn_len > 155; i++) { + if (filename[i] == '/') { + pfn_len = lfn - (filename + i + 1); } } if (pfn_len > 0) { - pfn = filename+i+1; + pfn = filename+i; } } else { pfn = filename;