Skip to content

Commit 976185a

Browse files
committed
Consider AES overhead when testing encrypted folder entries
1 parent ff8aa33 commit 976185a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,15 +1289,15 @@ private long TestLocalHeader(ZipEntry entry, HeaderTest tests)
12891289
// If so until details are known we will be strict.
12901290
if (entry.IsCrypted)
12911291
{
1292-
if (compressedSize > ZipConstants.CryptoHeaderSize + 2)
1292+
if (compressedSize > entry.EncryptionOverheadSize + 2)
12931293
{
12941294
throw new ZipException("Directory compressed size invalid");
12951295
}
12961296
}
12971297
else if (compressedSize > 2)
12981298
{
12991299
// When not compressed the directory size can validly be 2 bytes
1300-
// if the true size wasnt known when data was originally being written.
1300+
// if the true size wasn't known when data was originally being written.
13011301
// NOTE: Versions of the library 0.85.4 and earlier always added 2 bytes
13021302
throw new ZipException("Directory compressed size invalid");
13031303
}

0 commit comments

Comments
 (0)