diff options
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | src/suffix.c | 11 |
2 files changed, 12 insertions, 6 deletions
@@ -1,9 +1,12 @@ -GNU tar NEWS - User visible changes. 2018-03-18 +GNU tar NEWS - User visible changes. 2018-04-07 Please send GNU tar bug reports to <bug-tar@gnu.org> version 1.30.90 (Git) +* Fix heap-buffer-overrun with --one-top-level. +Bug introduced with the addition of that option in 1.28. + * Support for zstd compression New option '--zstd' instructs tar to use zstd as compression program. @@ -53,7 +56,7 @@ causing subsequent link extractions in that directory to fail. This new warning control option suppresses warning messages about unreadable files and directories. It has effect only if used together -with the --ignore-failed-read option. +with the --ignore-failed-read option. * The --warnings=none option now suppresses all warnings diff --git a/src/suffix.c b/src/suffix.c index 66b5694c..d787ea8f 100644 --- a/src/suffix.c +++ b/src/suffix.c @@ -62,7 +62,7 @@ find_compression_suffix (const char *name, size_t *ret_len) { size_t len; struct compression_suffix *p; - + suf++; len = strlen (suf); @@ -101,10 +101,14 @@ strip_compression_suffix (const char *name) { char *s = NULL; size_t len; + struct compression_suffix const *p = find_compression_suffix (name, &len); - if (find_compression_suffix (name, &len)) + if (p) { - if (strncmp (name + len - 4, ".tar", 4) == 0) + /* Strip an additional ".tar" suffix, but only if the just-stripped + "outer" suffix did not begin with "t". */ + if (len > 4 && strncmp (name + len - 4, ".tar", 4) == 0 + && p->suffix[0] != 't') len -= 4; if (len == 0) return NULL; @@ -114,4 +118,3 @@ strip_compression_suffix (const char *name) } return s; } - |