]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
tar: avoid read overrun
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 19 May 2020 18:52:01 +0000 (11:52 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 19 May 2020 18:52:26 +0000 (11:52 -0700)
Problem reported by Timotej Kapus in:
https://lists.gnu.org/r/bug-tar/2020-05/msg00001.html
* src/transform.c (parse_transform_expr):
Diagnose ‘--transform='s'’ instead of continuing past '\0'.

src/transform.c

index 0a4972a5de2f90af9934c147e8089897eda95f90..dea2eccefa7f2f8c95d7e733aa2d2030cd509865 100644 (file)
@@ -208,6 +208,8 @@ parse_transform_expr (const char *expr)
     }
 
   delim = expr[1];
+  if (!delim)
+    USAGE_ERROR ((0, 0, _("Invalid transform expression")));
 
   /* Scan regular expression */
   for (i = 2; expr[i] && expr[i] != delim; i++)