]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix check for ZIP_ENTRY_FLAG_ENCRYPTED 108/head
authorMaks Naumov <maksqwe1@ukr.net>
Tue, 10 Feb 2015 11:32:12 +0000 (13:32 +0200)
committerMaks Naumov <maksqwe1@ukr.net>
Tue, 10 Feb 2015 11:32:12 +0000 (13:32 +0200)
"zip->entry_flags | ZIP_ENTRY_FLAG_ENCRYPTED" is always true.

libarchive/archive_write_set_format_zip.c

index 0399b7b793db1fbd7a0e349866b16ea2e1e2323e..2033f962d8eb797fdf53de4eda19290d6a93968c 100644 (file)
@@ -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. */