Fix: Incorrect CommandLength calculation in NegotiateResponse

The SecurityBufferLength was used in the CommandLength calculation of NegotiateResponse, but it hadn't been assigned a value when creating the buffer length. Instead, SecurityBuffer.Length should be directly used. This change ensures the accurate calculation of the CommandLength and resolves the related issues.
This commit is contained in:
胡正 2025-04-25 16:07:00 +08:00
parent d40699d6dd
commit ca132ffe6e

View file

@ -105,7 +105,7 @@ namespace SMBLibrary.SMB2
} }
else else
{ {
int paddedSecurityBufferLength = (int)Math.Ceiling((double)SecurityBufferLength / 8) * 8; int paddedSecurityBufferLength = (int)Math.Ceiling((double)SecurityBuffer.Length / 8) * 8;
return FixedSize + paddedSecurityBufferLength + NegotiateContext.GetNegotiateContextListLength(NegotiateContextList); return FixedSize + paddedSecurityBufferLength + NegotiateContext.GetNegotiateContextListLength(NegotiateContextList);
} }
} }