mirror of https://github.com/acidanthera/audk.git
MdeModulePkg:Fix the bug the incorrect change of StrCpyS function
The pointer to the destination string changed,the max length also changed.Previous change neglect this point. And base on the code logic,we can use StrCatS to replace StrCpyS.Now this patch is to fix this bug. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18497 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
4e904348e3
commit
2d3e4cd167
|
@ -662,7 +662,7 @@ HiiConstructConfigHdr (
|
|||
//
|
||||
// Append L"&NAME="
|
||||
//
|
||||
StrCpyS (String, MaxLen, L"&NAME=");
|
||||
StrCatS (ReturnString, MaxLen, L"&NAME=");
|
||||
String += StrLen (String);
|
||||
|
||||
if (Name != NULL) {
|
||||
|
@ -677,7 +677,7 @@ HiiConstructConfigHdr (
|
|||
//
|
||||
// Append L"&PATH="
|
||||
//
|
||||
StrCpyS (String, MaxLen, L"&PATH=");
|
||||
StrCatS (ReturnString, MaxLen, L"&PATH=");
|
||||
String += StrLen (String);
|
||||
|
||||
//
|
||||
|
|
|
@ -1758,7 +1758,7 @@ ConstructConfigHdr (
|
|||
//
|
||||
// Append L"&NAME="
|
||||
//
|
||||
StrCpyS (String, MaxLen, L"&NAME=");
|
||||
StrCatS (ReturnString, MaxLen, L"&NAME=");
|
||||
String += StrLen (String);
|
||||
|
||||
if (Name != NULL) {
|
||||
|
@ -1773,7 +1773,7 @@ ConstructConfigHdr (
|
|||
//
|
||||
// Append L"&PATH="
|
||||
//
|
||||
StrCpyS (String, MaxLen, L"&PATH=");
|
||||
StrCatS (ReturnString, MaxLen, L"&PATH=");
|
||||
String += StrLen (String);
|
||||
|
||||
//
|
||||
|
@ -2044,14 +2044,10 @@ ExtractConfigRequest (
|
|||
StringPtr = *ConfigRequest;
|
||||
|
||||
StrCpyS (StringPtr, MaxLen, ConfigHdr);
|
||||
StringPtr += StrLen (StringPtr);
|
||||
|
||||
*StringPtr = L'&';
|
||||
StringPtr++;
|
||||
StrCatS (StringPtr, MaxLen, L"&");
|
||||
|
||||
StrCpyS (StringPtr, MaxLen, RequestElement);
|
||||
StringPtr += StrLen (StringPtr);
|
||||
*StringPtr = L'\0';
|
||||
StrCatS (StringPtr, MaxLen, RequestElement);
|
||||
|
||||
FreePool (ConfigHdr);
|
||||
FreePool (RequestElement);
|
||||
|
@ -2152,23 +2148,17 @@ ExtractConfigResp (
|
|||
StringPtr = *ConfigResp;
|
||||
|
||||
StrCpyS (StringPtr, MaxLen, ConfigHdr);
|
||||
StringPtr += StrLen (StringPtr);
|
||||
|
||||
*StringPtr = L'&';
|
||||
StringPtr++;
|
||||
StrCatS (StringPtr, MaxLen, L"&");
|
||||
|
||||
StrCpyS (StringPtr, MaxLen, RequestElement);
|
||||
StringPtr += StrLen (StringPtr);
|
||||
|
||||
*StringPtr = L'&';
|
||||
StringPtr++;
|
||||
|
||||
StrCpyS (StringPtr, MaxLen, L"VALUE=");
|
||||
StringPtr += StrLen (StringPtr);
|
||||
StrCatS (StringPtr, MaxLen, RequestElement);
|
||||
|
||||
StrCpyS (StringPtr, MaxLen, ValueElement);
|
||||
StringPtr += StrLen (StringPtr);
|
||||
*StringPtr = L'\0';
|
||||
StrCatS (StringPtr, MaxLen, L"&");
|
||||
|
||||
StrCatS (StringPtr, MaxLen, L"VALUE=");
|
||||
|
||||
StrCatS (StringPtr, MaxLen, ValueElement);
|
||||
|
||||
FreePool (ConfigHdr);
|
||||
FreePool (RequestElement);
|
||||
|
@ -2452,43 +2442,33 @@ GenerateKeywordResp (
|
|||
// 2.1 Copy NameSpaceId section.
|
||||
//
|
||||
StrCpyS (RespStr, RespStrLen, L"NAMESPACE=");
|
||||
RespStr += StrLen (RespStr);
|
||||
StrCpyS (RespStr, RespStrLen, UnicodeNameSpace);
|
||||
RespStr += StrLen (RespStr);
|
||||
|
||||
StrCatS (RespStr, RespStrLen, UnicodeNameSpace);
|
||||
|
||||
//
|
||||
// 2.2 Copy PathHdr section.
|
||||
//
|
||||
StrCpyS (RespStr, RespStrLen, PathHdr);
|
||||
RespStr += StrLen (RespStr);
|
||||
StrCatS (RespStr, RespStrLen, PathHdr);
|
||||
|
||||
//
|
||||
// 2.3 Copy Keyword section.
|
||||
//
|
||||
StrCpyS (RespStr, RespStrLen, L"KEYWORD=");
|
||||
RespStr += StrLen (RespStr);
|
||||
StrCpyS (RespStr, RespStrLen, KeywordData);
|
||||
RespStr += StrLen (RespStr);
|
||||
StrCatS (RespStr, RespStrLen, L"KEYWORD=");
|
||||
|
||||
StrCatS (RespStr, RespStrLen, KeywordData);
|
||||
|
||||
//
|
||||
// 2.4 Copy the Value section.
|
||||
//
|
||||
StrCpyS (RespStr, RespStrLen, ValueStr);
|
||||
RespStr += StrLen (RespStr);
|
||||
StrCatS (RespStr, RespStrLen, ValueStr);
|
||||
|
||||
//
|
||||
// 2.5 Copy ReadOnly section if exist.
|
||||
//
|
||||
if (ReadOnly) {
|
||||
StrCpyS (RespStr, RespStrLen, L"&READONLY");
|
||||
RespStr += StrLen (RespStr);
|
||||
StrCatS (RespStr, RespStrLen, L"&READONLY");
|
||||
}
|
||||
|
||||
//
|
||||
// 2.6 Add the end.
|
||||
//
|
||||
*RespStr = L'\0';
|
||||
|
||||
if (UnicodeNameSpace != NULL) {
|
||||
FreePool (UnicodeNameSpace);
|
||||
}
|
||||
|
@ -2536,12 +2516,9 @@ MergeToMultiKeywordResp (
|
|||
FreePool (*MultiKeywordResp);
|
||||
*MultiKeywordResp = StringPtr;
|
||||
|
||||
StringPtr += StrLen (StringPtr);
|
||||
StrCatS (StringPtr, MultiKeywordRespLen / sizeof (CHAR16), L"&");
|
||||
|
||||
*StringPtr = L'&';
|
||||
StringPtr++;
|
||||
|
||||
StrCpyS (StringPtr, MultiKeywordRespLen / sizeof (CHAR16), *KeywordResp);
|
||||
StrCatS (StringPtr, MultiKeywordRespLen / sizeof (CHAR16), *KeywordResp);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue