summaryrefslogtreecommitdiff
path: root/libarchive/archive_write_set_format_iso9660.c
diff options
context:
space:
mode:
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>2011-07-10 03:42:01 -0400
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>2011-07-10 03:42:01 -0400
commit0501e668b75bd6d490bf10469a73bcf18a93de57 (patch)
tree356753861c70d6e6f04ef44c9778481ebf6b00b7 /libarchive/archive_write_set_format_iso9660.c
parent2c3795fa7221fc9e4d6ae1aeac73b9e9e0d9601a (diff)
downloadlibarchive-0501e668b75bd6d490bf10469a73bcf18a93de57.tar.gz
In the ISO writer, ignore ineffective path names in the ISO9660 file system
such as "." , "/" or "../" and fix that handling. This is to improve r3464 changes. SVN-Revision: 3466
Diffstat (limited to 'libarchive/archive_write_set_format_iso9660.c')
-rw-r--r--libarchive/archive_write_set_format_iso9660.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/libarchive/archive_write_set_format_iso9660.c b/libarchive/archive_write_set_format_iso9660.c
index 0166e8df..62c039d2 100644
--- a/libarchive/archive_write_set_format_iso9660.c
+++ b/libarchive/archive_write_set_format_iso9660.c
@@ -1562,8 +1562,7 @@ iso9660_write_header(struct archive_write *a, struct archive_entry *entry)
* since we have already made the root directory of an ISO image.
*/
if (archive_strlen(&(file->parentdir)) == 0 &&
- archive_strlen(&(file->basename)) == 1 &&
- file->basename.s[0] == '.') {
+ archive_strlen(&(file->basename)) == 0) {
isofile_free(file);
return (r);
}
@@ -4817,22 +4816,24 @@ isofile_gen_utility_names(struct archive_write *a, struct isofile *file)
len = file->parentdir.length;
p = dirname = file->parentdir.s;
- if (p[0] == '/') {
- p++;
- len--;
- }
/*
- * Remove leading '../' and './' elements
+ * Remove leading '/', '../' and './' elements
*/
while (*p) {
- if (p[0] != '.')
+ if (p[0] == '/') {
+ p++;
+ len--;
+ } else if (p[0] != '.')
break;
- if (p[1] == '.' && p[2] == '/') {
+ else if (p[1] == '.' && p[2] == '/') {
p += 3;
len -= 3;
- } else if (p[1] == '/') {
+ } else if (p[1] == '/' || (p[1] == '.' && p[2] == '\0')) {
p += 2;
len -= 2;
+ } else if (p[1] == '\0') {
+ p++;
+ len--;
} else
break;
}