summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/HiiDatabaseDxe
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2015-09-17 07:21:22 +0000
committerdandanbi <dandanbi@Edk2>2015-09-17 07:21:22 +0000
commit2d3e4cd167614be3956264d81b6d64b33177b33f (patch)
tree2c6c56f0453c7ae26cbd6fb4264268cbf0a16dfc /MdeModulePkg/Universal/HiiDatabaseDxe
parent4e904348e323ae7b7d49c9f1716482d37a8f8fa4 (diff)
downloadedk2-2d3e4cd167614be3956264d81b6d64b33177b33f.zip
edk2-2d3e4cd167614be3956264d81b6d64b33177b33f.tar.gz
edk2-2d3e4cd167614be3956264d81b6d64b33177b33f.tar.bz2
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
Diffstat (limited to 'MdeModulePkg/Universal/HiiDatabaseDxe')
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c65
1 files changed, 21 insertions, 44 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c
index 6923d6c..52aa4d8 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c
@@ -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);
+
+ StrCatS (StringPtr, MaxLen, L"&");
+
+ StrCatS (StringPtr, MaxLen, L"VALUE=");
- StrCpyS (StringPtr, MaxLen, ValueElement);
- StringPtr += StrLen (StringPtr);
- *StringPtr = L'\0';
+ 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);
-
- *StringPtr = L'&';
- StringPtr++;
+ StrCatS (StringPtr, MultiKeywordRespLen / sizeof (CHAR16), L"&");
- StrCpyS (StringPtr, MultiKeywordRespLen / sizeof (CHAR16), *KeywordResp);
+ StrCatS (StringPtr, MultiKeywordRespLen / sizeof (CHAR16), *KeywordResp);
return EFI_SUCCESS;
}