Skip to content

Commit d44a158

Browse files
author
Tod Beardsley
committed
Land rapid7#1859, fix trailing newlines in zip.
This incidentally fixes rapid7#1755 for real, where most of the discussion of this bug took place.
2 parents 8680aa8 + 527f969 commit d44a158

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/zip/zip.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,8 @@ def read_e_o_c_d(io) #:nodoc:
12591259
@cdirOffset = ZipEntry::read_zip_long(buf)
12601260
commentLength = ZipEntry::read_zip_short(buf)
12611261
@comment = buf.read(commentLength)
1262+
# remove trailing \n symbol
1263+
buf.chomp!
12621264
raise ZipError, "Zip consistency problem while reading eocd structure" unless buf.size == 0
12631265
end
12641266

0 commit comments

Comments
 (0)