Fix: Incorrect CommandLength calculation in NegotiateResponse (#298)

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.

Co-authored-by: 胡正 <zheng@sharecreators.com>
This commit is contained in:
tanlng 2025-04-25 16:43:33 +08:00 committed by GitHub
parent d40699d6dd
commit 351f23ead9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -105,7 +105,7 @@ namespace SMBLibrary.SMB2
}
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);
}
}