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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user