Skip to content

Commit

Permalink
[efi] Avoid modifying PE/COFF debug filename
Browse files Browse the repository at this point in the history
The function efi_pecoff_debug_name() (called by efi_handle_name()) is
used to extract a filename from the debug data directory entry located
within a PE/COFF image.  The name is copied into a temporary static
buffer to allow for modifications, but the code currently erroneously
modifies the original name within the loaded PE/COFF image.

Fix by performing the modification on the copy in the temporary
buffer, as originally intended.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Nov 29, 2023
1 parent a147245 commit 98dd25a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/interface/efi/efi_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,10 +665,10 @@ efi_pecoff_debug_name ( EFI_LOADED_IMAGE_PROTOCOL *loaded ) {
snprintf ( buf, sizeof ( buf ), "%s", name );

/* Strip file suffix, if present */
if ( ( tmp = strrchr ( name, '.' ) ) != NULL )
if ( ( tmp = strrchr ( buf, '.' ) ) != NULL )
*tmp = '\0';

return name;
return buf;
}

/**
Expand Down

0 comments on commit 98dd25a

Please sign in to comment.