rhboot / shim

UEFI shim loader
Other
816 stars 284 forks source link

Size should minus 1 when calculating 'RelocBaseEnd' #581

Closed dennis-tseng99 closed 12 months ago

dennis-tseng99 commented 1 year ago

context->RelocDir->Size should minus one when calling ImageAddress(). Otherwise RelocBaseEnd will get NULL address after running ImageAddress() in which address=size.

ImageAddress (void *image, uint64_t size, uint64_t address)
{
        uintptr_t img_addr;

        /* ensure our local pointer isn't bigger than our size */
        if (address >= size)   <---- address=size
                return NULL;
        ........
}

RelocBaseEnd = ImageAddress(orig, size, Section->PointerToRawData + context->RelocDir->Size);

vathpela commented 11 months ago

I've force pushed fd43edacfe1eaa64d1c7b37ba23dae74e05d1a04 over this to make the commit message more informative.