summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-12-20 17:53:40 +0200
committerSergey Poznyakoff <gray@gnu.org>2018-12-21 13:54:11 +0200
commiteae48289c0848c5812644f20dbb1b39fb117a8f6 (patch)
tree792ca919b531e272f9dcf1654e69b299d3624c16
parent62c0c3a78076607b98c3b6199b6b0542609558b4 (diff)
downloadtar-eae48289c0848c5812644f20dbb1b39fb117a8f6.tar.gz
tar-eae48289c0848c5812644f20dbb1b39fb117a8f6.tar.bz2
Fix improper memory access
Bug reported in http://lists.gnu.org/archive/html/bug-tar/2018-12/msg00009.html * src/transform.c (parse_transform_expr): Check if re is not empty before accessing its last byte.
-rw-r--r--src/transform.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/transform.c b/src/transform.c
index 6ef0da6d..bbf20335 100644
--- a/src/transform.c
+++ b/src/transform.c
@@ -273,7 +273,7 @@ parse_transform_expr (const char *expr)
USAGE_ERROR ((0, 0, _("Invalid transform expression: %s"), errbuf));
}
- if (str[0] == '^' || str[strlen (str) - 1] == '$')
+ if (str[0] == '^' || (i > 2 && str[i - 3] == '$'))
tf->transform_type = transform_first;
free (str);

Return to:

Send suggestions and report system problems to the System administrator.