diff options
author | Oren Novotny <oren@novotny.org> | 2018-10-16 16:15:06 -0400 |
---|---|---|
committer | Oren Novotny <oren@novotny.org> | 2018-10-16 16:15:06 -0400 |
commit | d311746e67077c550960736762e02b5882cbeab2 (patch) | |
tree | 195d69a3065d79b898dcbffdc549af836a1a74f6 /crypto/src/bcpg | |
parent | merge from master (diff) | |
parent | Port PGP utility fix from Java (diff) | |
download | BouncyCastle.NET-ed25519-d311746e67077c550960736762e02b5882cbeab2.tar.xz |
merge from master
Diffstat (limited to 'crypto/src/bcpg')
-rw-r--r-- | crypto/src/bcpg/BcpgOutputStream.cs | 1 | ||||
-rw-r--r-- | crypto/src/bcpg/LiteralDataPacket.cs | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/crypto/src/bcpg/BcpgOutputStream.cs b/crypto/src/bcpg/BcpgOutputStream.cs index 7ab661edb..738c28211 100644 --- a/crypto/src/bcpg/BcpgOutputStream.cs +++ b/crypto/src/bcpg/BcpgOutputStream.cs @@ -376,6 +376,7 @@ namespace Org.BouncyCastle.Bcpg if (partialBuffer != null) { PartialFlush(true); + Array.Clear(partialBuffer, 0, partialBuffer.Length); partialBuffer = null; } } diff --git a/crypto/src/bcpg/LiteralDataPacket.cs b/crypto/src/bcpg/LiteralDataPacket.cs index 63a2c6d44..b4d28a201 100644 --- a/crypto/src/bcpg/LiteralDataPacket.cs +++ b/crypto/src/bcpg/LiteralDataPacket.cs @@ -23,7 +23,11 @@ namespace Org.BouncyCastle.Bcpg fileName = new byte[len]; for (int i = 0; i != len; ++i) { - fileName[i] = (byte)bcpgIn.ReadByte(); + int ch = bcpgIn.ReadByte(); + if (ch < 0) + throw new IOException("literal data truncated in header"); + + fileName[i] = (byte)ch; } modDate = (((uint)bcpgIn.ReadByte() << 24) |