diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c index 3ac95b7be6..8d4ae69bb2 100644 --- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c +++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c @@ -922,7 +922,7 @@ GetScatterGatherHeadEntries ( if (Index != 0) { UnicodeValueToStringS ( TempVarName, - (sizeof (CapsuleVarName) - ((StrLen (CapsuleVarName) + 1) * sizeof (CHAR16))), + (sizeof (CapsuleVarName) - ((UINTN)TempVarName - (UINTN)CapsuleVarName)), 0, Index, 0