Revision: 18498
http://sourceforge.net/p/edk2/code/18498
Author: hwu1225
Date: 2015-09-17 07:37:44 +0000 (Thu, 17 Sep 2015)
Log Message:
-----------
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.
(Sync patch r18497 from main trunk.)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <[email protected]>
Reviewed-by: Eric Dong <[email protected]>
Revision Links:
--------------
http://sourceforge.net/p/edk2/code/18497
Modified Paths:
--------------
branches/UDK2015/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
branches/UDK2015/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c
Modified: branches/UDK2015/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
===================================================================
--- branches/UDK2015/MdeModulePkg/Library/UefiHiiLib/HiiLib.c 2015-09-17
07:21:22 UTC (rev 18497)
+++ branches/UDK2015/MdeModulePkg/Library/UefiHiiLib/HiiLib.c 2015-09-17
07:37:44 UTC (rev 18498)
@@ -662,7 +662,7 @@
//
// Append L"&NAME="
//
- StrCpyS (String, MaxLen, L"&NAME=");
+ StrCatS (ReturnString, MaxLen, L"&NAME=");
String += StrLen (String);
if (Name != NULL) {
@@ -677,7 +677,7 @@
//
// Append L"&PATH="
//
- StrCpyS (String, MaxLen, L"&PATH=");
+ StrCatS (ReturnString, MaxLen, L"&PATH=");
String += StrLen (String);
//
Modified:
branches/UDK2015/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c
===================================================================
---
branches/UDK2015/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c
2015-09-17 07:21:22 UTC (rev 18497)
+++
branches/UDK2015/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c
2015-09-17 07:37:44 UTC (rev 18498)
@@ -1758,7 +1758,7 @@
//
// Append L"&NAME="
//
- StrCpyS (String, MaxLen, L"&NAME=");
+ StrCatS (ReturnString, MaxLen, L"&NAME=");
String += StrLen (String);
if (Name != NULL) {
@@ -1773,7 +1773,7 @@
//
// Append L"&PATH="
//
- StrCpyS (String, MaxLen, L"&PATH=");
+ StrCatS (ReturnString, MaxLen, L"&PATH=");
String += StrLen (String);
//
@@ -2044,14 +2044,10 @@
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,24 +2148,18 @@
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 @@
// 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,13 +2516,10 @@
FreePool (*MultiKeywordResp);
*MultiKeywordResp = StringPtr;
- StringPtr += StrLen (StringPtr);
+ StrCatS (StringPtr, MultiKeywordRespLen / sizeof (CHAR16), L"&");
- *StringPtr = L'&';
- StringPtr++;
+ StrCatS (StringPtr, MultiKeywordRespLen / sizeof (CHAR16), *KeywordResp);
- StrCpyS (StringPtr, MultiKeywordRespLen / sizeof (CHAR16), *KeywordResp);
-
return EFI_SUCCESS;
}
------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits