- Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Options[Index].OptionStr);\r
- Cur += AsciiStrLen ((CHAR8 *) Options[Index].OptionStr) + 1;\r
- Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Options[Index].ValueStr);\r
- Cur += AsciiStrLen ((CHAR8 *) (CHAR8 *) Options[Index].ValueStr) + 1;\r
+ OptionStrLength = AsciiStrLen ((CHAR8 *) Options[Index].OptionStr);\r
+ ValueStrLength = AsciiStrLen ((CHAR8 *) Options[Index].ValueStr);\r
+ \r
+ Status = AsciiStrCpyS ((CHAR8 *) Cur, BufferLength, (CHAR8 *) Options[Index].OptionStr);\r
+ ASSERT_EFI_ERROR (Status);\r
+ BufferLength -= (UINT32) (OptionStrLength + 1);\r
+ Cur += OptionStrLength + 1;\r
+ \r
+ Status = AsciiStrCpyS ((CHAR8 *) Cur, BufferLength, (CHAR8 *) Options[Index].ValueStr);\r
+ ASSERT_EFI_ERROR (Status);\r
+ BufferLength -= (UINT32) (ValueStrLength + 1);\r
+ Cur += ValueStrLength + 1;\r
+ \r