Skip to content

Commit

Permalink
Restrict DLL names to the printable ASCII range.
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed Apr 19, 2024
1 parent 5317a2b commit b680038
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libyara/modules/pe/pe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,9 +1009,9 @@ static IMPORT_FUNCTION* pe_parse_import_descriptor(
}

//
// In Windows PE files, any character including 0x20 and above is allowed.
// The only exceptions are characters that are invalid for file names in
// Windows, which are "*<>?|. While they still can be present in the import
// In Windows PE files, any printable character including 0x20 and above is
// allowed. The only exceptions are characters that are invalid for file names
// in Windows, which are "*<>?|. While they still can be present in the import
// directory, such module can never be present in Windows, so we can treat them
// as invalid.
//
Expand Down Expand Up @@ -1041,8 +1041,8 @@ static int pe_valid_dll_name(const char* dll_name, size_t n)

while (l < n && *c != '\0')
{
if (*c < ' ' || *c == '\"' || *c == '*' || *c == '<' || *c == '>' ||
*c == '?' || *c == '|')
if (*c < ' ' || *c > 0x7e || *c == '\"' || *c == '*' || *c == '<' ||
*c == '>' || *c == '?' || *c == '|')
{
return false;
}
Expand Down

0 comments on commit b680038

Please sign in to comment.