提交 9d30a941 编写于 作者: A Asherah Connor 提交者: Heinrich Schuchardt

efi_loader: don't load beyond VirtualSize

PE section table entries' SizeOfRawData must be a multiple of
FileAlignment, and thus may be rounded up and larger than their
VirtualSize.

We should not load beyond the VirtualSize, which is "the total size of
the section when loaded into memory" -- we may clobber real data at the
target in some other section, since we load sections in reverse order
and sections are usually laid out sequentially.
Signed-off-by: NAsherah Connor <ashe@kivikakk.ee>
Reviewed-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
上级 7c82e12c
......@@ -843,7 +843,7 @@ efi_status_t efi_load_pe(struct efi_loaded_image_obj *handle,
sec->Misc.VirtualSize);
memcpy(efi_reloc + sec->VirtualAddress,
efi + sec->PointerToRawData,
sec->SizeOfRawData);
min(sec->Misc.VirtualSize, sec->SizeOfRawData));
}
/* Run through relocations */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册