From 1855dd1d565ce1904defd283301ede174facbd43 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Sat, 27 Jan 2024 10:15:33 -0800 Subject: [PATCH] Fixes authenticode signing if a section name starts with an underscore. --- authenticode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/authenticode.js b/authenticode.js index 821cf7ae..a3ff1a01 100644 --- a/authenticode.js +++ b/authenticode.js @@ -298,7 +298,7 @@ function createAuthenticodeHandler(path) { for (var i = 0; i < obj.header.coff.numberOfSections; i++) { var section = {}; buf = readFileSlice(obj.header.SectionHeadersPtr + (i * 40), 40); - if (buf[0] != 46) { obj.close(); return false; }; // Name of the section must start with a dot. If not, something is wrong. + 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. var sectionName = buf.slice(0, 8).toString().trim('\0'); var j = sectionName.indexOf('\0'); if (j >= 0) { sectionName = sectionName.substring(0, j); } // Trim any trailing zeroes