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=\"
This commit is contained in:
committed by
Sergey Poznyakoff
parent
e5bc23efcc
commit
93082d6eb8
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user