Skip to content

Commit

Permalink
Fixed MD4 to only dispose internal buffers if disposing == true
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed Apr 15, 2023
1 parent 99576c4 commit 20e041d
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions MailKit/Security/Ntlm/MD4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,24 +379,26 @@ public byte[] TransformFinalBlock (byte[] inputBuffer, int inputOffset, int inpu

void Dispose (bool disposing)
{
if (buffered != null) {
Array.Clear (buffered, 0, buffered.Length);
buffered = null;
}

if (state != null) {
Array.Clear (state, 0, state.Length);
state = null;
}

if (count != null) {
Array.Clear (count, 0, count.Length);
count = null;
}

if (x != null) {
Array.Clear (x, 0, x.Length);
x = null;
if (disposing) {
if (buffered != null) {
Array.Clear (buffered, 0, buffered.Length);
buffered = null;
}

if (state != null) {
Array.Clear (state, 0, state.Length);
state = null;
}

if (count != null) {
Array.Clear (count, 0, count.Length);
count = null;
}

if (x != null) {
Array.Clear (x, 0, x.Length);
x = null;
}
}
}

Expand Down

0 comments on commit 20e041d

Please sign in to comment.