MdePkg: Reinitialize twice-iterated VA_LIST in variadic function UefiDevicePathLibCatPrint()

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zenith432 <zenith432@users.sourceforge.net>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Zenith432 2016-05-16 23:50:06 +08:00 committed by Liming Gao
parent 415700ec3e
commit b98993580e
1 changed files with 2 additions and 0 deletions

View File

@ -42,6 +42,7 @@ UefiDevicePathLibCatPrint (
VA_START (Args, Fmt);
Count = SPrintLength (Fmt, Args);
VA_END(Args);
if ((Str->Count + (Count + 1)) * sizeof (CHAR16) > Str->Capacity) {
Str->Capacity = (Str->Count + (Count + 1) * 2) * sizeof (CHAR16);
@ -52,6 +53,7 @@ UefiDevicePathLibCatPrint (
);
ASSERT (Str->Str != NULL);
}
VA_START (Args, Fmt);
UnicodeVSPrint (&Str->Str[Str->Count], Str->Capacity - Str->Count * sizeof (CHAR16), Fmt, Args);
Str->Count += Count;