Fixes authenticode signing if a section name starts with an underscore.

Ylian Saint-Hilaire committed Jan 27, 2024 at 10:15 UTC 1855dd1d565ce1904defd283301ede174facbd43
1 file changed +1 -1
authenticode.js
+1 -1
@@ -298,7 +298,7 @@ function createAuthenticodeHandler(path) {
298 for (var i = 0; i < obj.header.coff.numberOfSections; i++) {
299 var section = {};
300 buf = readFileSlice(obj.header.SectionHeadersPtr + (i * 40), 40);
301 - if (buf[0] != 46) { obj.close(); return false; }; // Name of the section must start with a dot. If not, something is wrong.
301 + if ((buf[0] != 46) && (buf[0] != 95)) { obj.close(); return false; }; // Name of the section must start with a dot or underscore. If not, something is wrong.
302 var sectionName = buf.slice(0, 8).toString().trim('\0');
303 var j = sectionName.indexOf('\0');
304 if (j >= 0) { sectionName = sectionName.substring(0, j); } // Trim any trailing zeroes