Parcourir la source

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=\"
Samanta Navarro il y a 3 ans
Parent
commit
93082d6eb8
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      src/checkpoint.c

+ 1 - 1
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;