mirror of
https://github.com/atom0s/Steamless.git
synced 2024-12-19 23:07:41 +01:00
Unpacker: (variant31.x86) Fixed AES decryption not properly handling the code section, leading to junk data being copied into unpacked file.
Unpacker: (variant31.x86) Fixed AES decryption not properly preserving non-encrypted data.
This commit is contained in:
parent
4c2c218a72
commit
a278875e1c
1 changed files with 7 additions and 4 deletions
|
@ -404,9 +404,9 @@ namespace Steamless.Unpacker.Variant31.x86
|
|||
this.Log($" --> {codeSection.SectionName} section is encrypted.", LogMessageType.Debug);
|
||||
|
||||
// Obtain the code section data..
|
||||
var codeSectionData = new byte[codeSection.SizeOfRawData + this.StubHeader.CodeSectionStolenData.Length];
|
||||
var codeSectionData = new byte[(long)this.StubHeader.CodeSectionRawSize + this.StubHeader.CodeSectionStolenData.Length];
|
||||
Array.Copy(this.StubHeader.CodeSectionStolenData, 0, codeSectionData, 0, this.StubHeader.CodeSectionStolenData.Length);
|
||||
Array.Copy(this.File.FileData, this.File.GetFileOffsetFromRva(codeSection.VirtualAddress), codeSectionData, this.StubHeader.CodeSectionStolenData.Length, codeSection.SizeOfRawData);
|
||||
Array.Copy(this.File.FileData, this.File.GetFileOffsetFromRva(codeSection.VirtualAddress), codeSectionData, this.StubHeader.CodeSectionStolenData.Length, (long)this.StubHeader.CodeSectionRawSize);
|
||||
|
||||
// Create the AES decryption helper..
|
||||
var aes = new AesHelper(this.StubHeader.AES_Key, this.StubHeader.AES_IV);
|
||||
|
@ -417,8 +417,11 @@ namespace Steamless.Unpacker.Variant31.x86
|
|||
if (data == null)
|
||||
return false;
|
||||
|
||||
// Set the code section override data..
|
||||
this.CodeSectionData = data;
|
||||
// Merge the code section data into the original..
|
||||
var sectionData = this.File.SectionData[this.CodeSectionIndex];
|
||||
Array.Copy(data, sectionData, (long)this.StubHeader.CodeSectionRawSize);
|
||||
|
||||
this.CodeSectionData = sectionData;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue