From e1592d91be4e8f0abc2ef1a5687fdd6966bc5b27 Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Fri, 10 Mar 2023 09:32:52 -0800 Subject: [PATCH] pe: fix certificate table parsing There appear to be an off-by-one error in the parsing of the certificate table. This error would occur when the cert table is at the end of the binary. --- src/pe/certificate_table.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pe/certificate_table.rs b/src/pe/certificate_table.rs index d873738be..913d64375 100644 --- a/src/pe/certificate_table.rs +++ b/src/pe/certificate_table.rs @@ -139,7 +139,7 @@ pub(crate) fn enumerate_certificates( let mut attrs = vec![]; // End offset cannot be further than the binary we have at hand. - if table_end_offset >= bytes.len() { + if table_end_offset > bytes.len() { return Err(error::Error::Malformed( "End of attribute certificates table is after the end of the PE binary".to_string(), ));