From 93082d6eb84a086b02c7a8607f2553d5d9d0a93c Mon Sep 17 00:00:00 2001 From: Samanta Navarro Date: Fri, 11 Jun 2021 11:52:31 +0000 Subject: 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=\" --- src/checkpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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; -- cgit v1.2.1