aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2023-11-29 12:49:06 +0000
committerMichael Brown <mcb30@ipxe.org>2023-11-29 12:49:06 +0000
commit98dd25a3bb2d3aafa71f088cbabf89418a783132 (patch)
tree37f5e66f0e933c9d921e6aeb7a823a602033e4ad
parenta147245f1a2f92a85a75226ea921acb22322ab4d (diff)
downloadipxe-98dd25a3bb2d3aafa71f088cbabf89418a783132.zip
ipxe-98dd25a3bb2d3aafa71f088cbabf89418a783132.tar.gz
ipxe-98dd25a3bb2d3aafa71f088cbabf89418a783132.tar.bz2
[efi] Avoid modifying PE/COFF debug filename
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>
-rw-r--r--src/interface/efi/efi_debug.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/interface/efi/efi_debug.c b/src/interface/efi/efi_debug.c
index 1372776..ad79f0d 100644
--- a/src/interface/efi/efi_debug.c
+++ b/src/interface/efi/efi_debug.c
@@ -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;
}
/**