]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Minor improvement in the mtree bidder.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Wed, 26 Sep 2012 04:04:56 +0000 (13:04 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Wed, 26 Sep 2012 04:04:56 +0000 (13:04 +0900)
 - During checking NetBSD mtree -D format, if the first character of
   the last filed in an entry line is '/', fail the test bidding mtree
   format.

libarchive/archive_read_support_format_mtree.c

index d3a2a14b138e71b9db8062821dab47dc0216d8b0..b8a18eb7b517d3a98dbb4fd5b8541cfdfaa0ad06 100644 (file)
@@ -548,6 +548,10 @@ bid_entry(const char *p, ssize_t len, ssize_t nl, int *last_is_path)
                }
                if (name_len == 0 || slash == 0)
                        return (-1);
+               /* If '/' is placed at the first in this field, this is not
+                * a valid filename. */
+               if (pb[1] == '/')
+                       return (-1);
                ll = len - nl - name_len;
                pp = p;
                *last_is_path = 1;