Zebediah Figura (@zfigura) commented about dlls/mspatcha/pa19.c:
- }
- nt_headers->OptionalHeader.ImageBase = (DWORD)new_image_base;
- result = TRUE;
- reloc_dir_remaining = (LONG)reloc_dir_size;
- while (reloc_dir_remaining > 0) {
if (reloc_block->SizeOfBlock <= (ULONG)reloc_dir_remaining
&& reloc_block->SizeOfBlock > sizeof(IMAGE_BASE_RELOCATION))
{
reloc_block_base = (IMAGE_BASE_RELOCATION UNALIGNED *)(mapped_image_base +
image_rva_to_file_offset(nt_headers, reloc_block->VirtualAddress, mapped_image_base, mapped_image_size));
if (reloc_block_base)
{
reloc = (USHORT UNALIGNED *)((PUCHAR)reloc_block + sizeof(IMAGE_BASE_RELOCATION));
I don't think we want UNALIGNED, not least because it doesn't do anything on non-MSVC compilers. If any of these actually can be unaligned (can they?) then I think we should just use memcpy.