From 1536a85a013814d1c965d08397faf0d86067e119 Mon Sep 17 00:00:00 2001 From: Maks Naumov Date: Tue, 10 Feb 2015 13:32:12 +0200 Subject: [PATCH] Fix check for ZIP_ENTRY_FLAG_ENCRYPTED "zip->entry_flags | ZIP_ENTRY_FLAG_ENCRYPTED" is always true. --- libarchive/archive_write_set_format_zip.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c index 0399b7b79..2033f962d 100644 --- a/libarchive/archive_write_set_format_zip.c +++ b/libarchive/archive_write_set_format_zip.c @@ -692,7 +692,7 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) version_needed = 20; } - if (zip->entry_flags | ZIP_ENTRY_FLAG_ENCRYPTED) { + if (zip->entry_flags & ZIP_ENTRY_FLAG_ENCRYPTED) { switch (zip->entry_encryption) { case ENCRYPTION_TRADITIONAL: additional_size = TRAD_HEADER_SIZE; @@ -739,7 +739,7 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) version_needed = 20; } - if (zip->entry_flags | ZIP_ENTRY_FLAG_ENCRYPTED) { + if (zip->entry_flags & ZIP_ENTRY_FLAG_ENCRYPTED) { switch (zip->entry_encryption) { case ENCRYPTION_TRADITIONAL: case ENCRYPTION_WINZIP_AES128: @@ -857,7 +857,7 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) e += 4; /* AES extra data field: WinZIP AES information, ID=0x9901 */ - if ((zip->entry_flags | ZIP_ENTRY_FLAG_ENCRYPTED) + if ((zip->entry_flags & ZIP_ENTRY_FLAG_ENCRYPTED) && (zip->entry_encryption == ENCRYPTION_WINZIP_AES128 || zip->entry_encryption == ENCRYPTION_WINZIP_AES256)) { @@ -994,7 +994,7 @@ archive_write_zip_data(struct archive_write *a, const void *buff, size_t s) if (s == 0) return 0; - if (zip->entry_flags | ZIP_ENTRY_FLAG_ENCRYPTED) { + if (zip->entry_flags & ZIP_ENTRY_FLAG_ENCRYPTED) { switch (zip->entry_encryption) { case ENCRYPTION_TRADITIONAL: /* Initialize traditoinal PKWARE encryption context. */ -- 2.47.2