mirror of
https://github.com/acidanthera/audk.git
synced 2025-09-21 16:57:44 +02:00
ImageTool: Prefer AllocateCopyPool()
This commit is contained in:
parent
329772c824
commit
6bae938f40
@ -202,14 +202,15 @@ ScanPeGetSegmentInfo (
|
||||
&& memcmp (Section->Name, PE_COFF_SECT_NAME_RELOC, sizeof (Section->Name)) != 0
|
||||
&& memcmp (Section->Name, PE_COFF_SECT_NAME_RESRC, sizeof (Section->Name)) != 0
|
||||
&& memcmp (Section->Name, PE_COFF_SECT_NAME_DEBUG, sizeof (Section->Name)) != 0) {
|
||||
ImageSegment->Name = AllocateZeroPool (sizeof (Section->Name));
|
||||
ImageSegment->Name = AllocateCopyPool (
|
||||
sizeof (Section->Name),
|
||||
Section->Name
|
||||
);
|
||||
if (ImageSegment->Name == NULL) {
|
||||
fprintf (stderr, "ImageTool: Could not allocate memory for Segment Name\n");
|
||||
return RETURN_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
memmove (ImageSegment->Name, Section->Name, sizeof (Section->Name));
|
||||
|
||||
ImageSegment->ImageAddress = Section->VirtualAddress;
|
||||
ImageSegment->ImageSize = ALIGN_VALUE (Section->VirtualSize, SegmentInfo->SegmentAlignment);
|
||||
ImageSegment->Read = (Section->Characteristics & EFI_IMAGE_SCN_MEM_READ) != 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user