summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamanta Navarro <ferivoz@riseup.net>2021-06-11 11:52:31 +0000
committerSergey Poznyakoff <gray@gnu.org>2021-07-01 09:52:42 +0300
commit93082d6eb84a086b02c7a8607f2553d5d9d0a93c (patch)
tree3b26204e84ac11a0e2f5e41a445ec9f000add62d /src
parente5bc23efcc90700710f97379d3116febc5705e19 (diff)
downloadtar-93082d6eb84a086b02c7a8607f2553d5d9d0a93c.tar.gz
Fix crash on invalid command line argument
The copy_string_unquote function does not handle arguments which only consist of a single quote. A string is only quoted if two quoting characters exist. How to reproduce: tar --checkpoint-action exec=\"
Diffstat (limited to 'src')
-rw-r--r--src/checkpoint.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/checkpoint.c b/src/checkpoint.c
index eb12c1c0..9d4895cc 100644
--- a/src/checkpoint.c
+++ b/src/checkpoint.c
@@ -84,7 +84,7 @@ copy_string_unquote (const char *str)
char *output = xstrdup (str);
size_t len = strlen (output);
if ((*output == '"' || *output == '\'')
- && output[len-1] == *output)
+ && len > 1 && output[len-1] == *output)
{
memmove (output, output+1, len-2);
output[len-2] = 0;