Skip to content

Commit

Permalink
fix: allow empty DLL names, as YARA does.
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed May 7, 2024
1 parent 306a730 commit 17a15b0
Show file tree
Hide file tree
Showing 3 changed files with 466 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/src/modules/pe/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,9 @@ impl<'a> PE<'a> {
if let Ok((_, rsrc_entry)) =
Self::parse_rsrc_entry(entry_data)
{
if rsrc_entry.size > 0 && rsrc_entry.offset > 0 && (rsrc_entry.size as usize) < self.data.len()
if rsrc_entry.size > 0
&& rsrc_entry.offset > 0
&& (rsrc_entry.size as usize) < self.data.len()
{
resources.push(Resource {
type_id: ids.0,
Expand Down Expand Up @@ -2162,10 +2164,6 @@ impl<'a> PE<'a> {
// limit of 256 bytes, though.
let dll_name = self.str_at_rva(rva)?;

if dll_name.is_empty() {
return None;
}

for c in dll_name.chars() {
if c.is_ascii_control() {
return None;
Expand Down
Binary file not shown.
Loading

0 comments on commit 17a15b0

Please sign in to comment.