Skip to content

Commit

Permalink
Fixing a truncated string output when trying to dump the current sett…
Browse files Browse the repository at this point in the history
…ings (#23)

The original implementation would rely on the printing stack to print the entire collected xml as string, which is truncated by the %a parser. This change fixed the issue by dumping the string in a loop till all characters are printed.
  • Loading branch information
kuqin12 authored Aug 18, 2022
1 parent 44fa0cc commit ff34daf
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion SetupDataPkg/ConfApp/SetupConf.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,8 @@ SetupConfMgr (
EFI_KEY_DATA KeyData;
CHAR8 *StrBuf;
UINTN StrBufSize;
UINTN Index;
UINTN PrintedUnicode;

switch (mSetupConfState) {
case SetupConfInit:
Expand Down Expand Up @@ -997,7 +999,18 @@ SetupConfMgr (
Status = EFI_SUCCESS;
} else {
Print (L"\nCurrent configurations are dumped Below in format of *.SVD:\n");
Print (L"\n%a\n", StrBuf);
Print (L"\n");
Index = 0;
while (Index < StrBufSize) {
PrintedUnicode = Print (L"%a", &StrBuf[Index]);
Index += PrintedUnicode;
if (PrintedUnicode == 0) {
// So that we will not get stuck if Print function malfunctions
break;
}
}

Print (L"\n");
}

mSetupConfState = SetupConfDumpComplete;
Expand Down

0 comments on commit ff34daf

Please sign in to comment.