From: Tim Kientzle Date: Sat, 13 Sep 2025 18:17:38 +0000 (-0700) Subject: Only set the filename-present bit if we actually write the filename X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e5c2eb783b1582534dfbf064265393527a71ec97;p=thirdparty%2Flibarchive.git Only set the filename-present bit if we actually write the filename --- diff --git a/libarchive/archive_write_add_filter_gzip.c b/libarchive/archive_write_add_filter_gzip.c index 6784798d2..47081cc30 100644 --- a/libarchive/archive_write_add_filter_gzip.c +++ b/libarchive/archive_write_add_filter_gzip.c @@ -222,7 +222,7 @@ archive_compressor_gzip_open(struct archive_write_filter *f) data->compressed[0] = 0x1f; /* GZip signature bytes */ data->compressed[1] = 0x8b; data->compressed[2] = 0x08; /* "Deflate" compression */ - data->compressed[3] = data->original_filename == NULL ? 0 : 0x8; + data->compressed[3] = 0x00; /* Flags */ if (data->timestamp >= 0) { time_t t = time(NULL); data->compressed[4] = (uint8_t)(t)&0xff; /* Timestamp */ @@ -257,6 +257,7 @@ archive_compressor_gzip_open(struct archive_write_filter *f) ofn_max_length = ofn_space_available; } if (ofn_length < ofn_max_length) { + data->compressed[3] |= 0x8; strcpy((char*)data->compressed + 10, data->original_filename); data->stream.next_out += ofn_length + 1;