mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-30 10:47:48 +02:00
SMB2: CreateContext: Bugfix: Correct Name and Data offset write location
This commit is contained in:
parent
3247f0365e
commit
773d42375d
1 changed files with 4 additions and 4 deletions
|
@ -59,12 +59,12 @@ namespace SMBLibrary.SMB2
|
||||||
NameLength = (ushort)Name.Length;
|
NameLength = (ushort)Name.Length;
|
||||||
if (Name.Length > 0)
|
if (Name.Length > 0)
|
||||||
{
|
{
|
||||||
NameOffset = (ushort)FixedLength;
|
NameOffset = FixedLength;
|
||||||
}
|
}
|
||||||
LittleEndianWriter.WriteUInt16(buffer, offset + 4, NameOffset);
|
LittleEndianWriter.WriteUInt16(buffer, offset + 4, NameOffset);
|
||||||
LittleEndianWriter.WriteUInt16(buffer, offset + 6, NameLength);
|
LittleEndianWriter.WriteUInt16(buffer, offset + 6, NameLength);
|
||||||
LittleEndianWriter.WriteUInt16(buffer, offset + 8, Reserved);
|
LittleEndianWriter.WriteUInt16(buffer, offset + 8, Reserved);
|
||||||
DataOffset = 0;
|
DataOffset = (ushort)(FixedLength + NameLength);
|
||||||
DataLength = (uint)Data.Length;
|
DataLength = (uint)Data.Length;
|
||||||
if (Data.Length > 0)
|
if (Data.Length > 0)
|
||||||
{
|
{
|
||||||
|
@ -72,8 +72,8 @@ namespace SMBLibrary.SMB2
|
||||||
DataOffset = (ushort)(FixedLength + paddedNameLength);
|
DataOffset = (ushort)(FixedLength + paddedNameLength);
|
||||||
}
|
}
|
||||||
LittleEndianWriter.WriteUInt16(buffer, offset + 10, DataOffset);
|
LittleEndianWriter.WriteUInt16(buffer, offset + 10, DataOffset);
|
||||||
ByteWriter.WriteAnsiString(buffer, NameOffset, Name);
|
ByteWriter.WriteAnsiString(buffer, offset + NameOffset, Name);
|
||||||
ByteWriter.WriteBytes(buffer, DataOffset, Data);
|
ByteWriter.WriteBytes(buffer, offset + DataOffset, Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Length
|
public int Length
|
||||||
|
|
Loading…
Add table
Reference in a new issue