Safer opening of CABs

This commit is contained in:
Matt Nadareski
2022-05-22 13:13:42 -07:00
parent 2ce8bda394
commit 90bc78982c
2 changed files with 10 additions and 3 deletions

View File

@@ -196,9 +196,9 @@ namespace LibMSPackSharp.CAB
return;
// Expect less than 60,000, but don't validate
HeaderReserved = BitConverter.ToUInt16(buffer, 0x24);
FolderReserved = buffer[0x26];
DataReserved = buffer[0x27];
HeaderReserved = BitConverter.ToUInt16(buffer, 0x00);
FolderReserved = buffer[0x02];
DataReserved = buffer[0x03];
}
}
}

View File

@@ -44,8 +44,15 @@ namespace BurnOutSharp.FileType
// Create the decompressor
var decompressor = Library.CreateCABDecompressor(null);
// Open the cab file
var cabFile = decompressor.Open(file);
if (cabFile == null)
{
if (scanner.IncludeDebug) Console.WriteLine($"Error occurred opening of '{file}': {decompressor.Error}");
return null;
}
// Loop through the found internal files
var sub = cabFile.Files;
while (sub != null)
{