Fix malformed PE certificates

This commit is contained in:
Matt Nadareski
2022-12-03 23:09:45 -08:00
parent fe5a674518
commit 26db75853b

View File

@@ -707,7 +707,7 @@ namespace BurnOutSharp.Builder
entry.Length = data.ReadUInt32(ref offset);
entry.Revision = (WindowsCertificateRevision)data.ReadUInt16(ref offset);
entry.CertificateType = (WindowsCertificateType)data.ReadUInt16(ref offset);
if (entry.Length > 0)
if (entry.Length - 8 > 0)
entry.Certificate = data.ReadBytes(ref offset, (int)entry.Length - 8);
attributeCertificateTable.Add(entry);
@@ -1856,7 +1856,7 @@ namespace BurnOutSharp.Builder
entry.Length = data.ReadUInt32();
entry.Revision = (WindowsCertificateRevision)data.ReadUInt16();
entry.CertificateType = (WindowsCertificateType)data.ReadUInt16();
if (entry.Length > 0)
if (entry.Length - 8 > 0)
entry.Certificate = data.ReadBytes((int)entry.Length - 8);
attributeCertificateTable.Add(entry);