Skip to content

Commit d11b09d

Browse files
committed
Mark some MemoryStream usages non-writable
1 parent 2df7c64 commit d11b09d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

crypto/src/bcpg/SignaturePacket.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ private void SetCreationTime()
385385

386386
public static SignaturePacket FromByteArray(byte[] data)
387387
{
388-
BcpgInputStream input = BcpgInputStream.Wrap(new MemoryStream(data));
388+
BcpgInputStream input = BcpgInputStream.Wrap(new MemoryStream(data, writable: false));
389389

390390
return new SignaturePacket(input);
391391
}

crypto/src/openpgp/PgpSecretKeyRing.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private PgpSecretKeyRing(
3636

3737
public PgpSecretKeyRing(
3838
byte[] encoding)
39-
: this(new MemoryStream(encoding))
39+
: this(new MemoryStream(encoding, writable: false))
4040
{
4141
}
4242

crypto/src/tls/TlsExtensionsUtilities.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ public static IList<ProtocolName> ReadAlpnExtensionClient(byte[] extensionData)
981981
if (extensionData == null)
982982
throw new ArgumentNullException(nameof(extensionData));
983983

984-
MemoryStream buf = new MemoryStream(extensionData);
984+
MemoryStream buf = new MemoryStream(extensionData, writable: false);
985985

986986
int length = TlsUtilities.ReadUint16(buf);
987987
if (length != (extensionData.Length - 2))
@@ -1015,7 +1015,7 @@ public static IList<X509Name> ReadCertificateAuthoritiesExtension(byte[] extensi
10151015
if (extensionData.Length < 5)
10161016
throw new TlsFatalAlert(AlertDescription.decode_error);
10171017

1018-
MemoryStream buf = new MemoryStream(extensionData);
1018+
MemoryStream buf = new MemoryStream(extensionData, writable: false);
10191019

10201020
int length = TlsUtilities.ReadUint16(buf);
10211021
if (length != (extensionData.Length - 2))

0 commit comments

Comments
 (0)