MdeModulePkg/ImagePropertiesRecordLib: Fix incorrect use of sizeof

In GetFilename(), the post-loop fallback termination used
sizeof (EfiFileName), which is the size of the CHAR8 * pointer
parameter (8 bytes on X64), not the buffer size. Use EfiFileNameSize -
4 to match the bound of the copy loop above so the string is
terminated at the true end of the buffer.

Tested on OvmfPkgIa32X64, DEBUG, GCC: DumpImageRecords() prints all
runtime image names correctly and NUL-terminated, with no ASSERTs.

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
This commit is contained in:
Mingjie Shen 2026-07-23 23:28:15 +00:00
parent cc9a0425a2
commit 0fef1e5570

View file

@ -864,7 +864,7 @@ GetFilename (
}
}
if (Index == sizeof (EfiFileName) - 4) {
if (Index == EfiFileNameSize - 4) {
EfiFileName[Index] = 0;
}
}