mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-09-22 14:54:56 +00:00
Be slightly safer on PE string table parsing
This commit is contained in:
@@ -541,6 +541,12 @@ namespace BurnOutSharp.Builder
|
||||
else
|
||||
{
|
||||
string fullEncodedString = stringEncoding.GetString(entry.Data, offset, entry.Data.Length - offset);
|
||||
if (stringLength > fullEncodedString.Length)
|
||||
{
|
||||
// TODO: Print to console or return an error?
|
||||
stringLength = (ushort)fullEncodedString.Length;
|
||||
}
|
||||
|
||||
string stringValue = fullEncodedString.Substring(0, stringLength);
|
||||
offset += stringEncoding.GetByteCount(stringValue);
|
||||
stringValue = stringValue.Replace("\n", "\\n").Replace("\r", "\\r");
|
||||
|
||||
Reference in New Issue
Block a user