diff --git a/shim.c b/shim.c index f29f39214..32d2772b2 100644 --- a/shim.c +++ b/shim.c @@ -1640,9 +1640,11 @@ static EFI_STATUS generate_path_from_image_path(EFI_LOADED_IMAGE *li, bootpath[j] = '\0'; } - while (*ImagePath == '\\') - ImagePath++; + for (i = 0, last = 0; i < StrLen(ImagePath); i++) + if (ImagePath[i] == '\\') + last = i + 1; + ImagePath = ImagePath + last; *PathName = AllocatePool(StrSize(bootpath) + StrSize(ImagePath)); if (!*PathName) {