From 66b1a0b7a3b543f2e6f5ae9d59f3de04b80134a0 Mon Sep 17 00:00:00 2001 From: Michihiro NAKAJIMA Date: Wed, 26 Sep 2012 13:04:56 +0900 Subject: [PATCH] Minor improvement in the mtree bidder. - 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libarchive/archive_read_support_format_mtree.c b/libarchive/archive_read_support_format_mtree.c index d3a2a14b1..b8a18eb7b 100644 --- a/libarchive/archive_read_support_format_mtree.c +++ b/libarchive/archive_read_support_format_mtree.c @@ -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; -- 2.47.3