diff options
author | Eric Dong <eric.dong@intel.com> | 2014-07-30 01:19:21 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-07-30 01:19:21 +0000 |
commit | 784952b1898a5a8b65143a88b56b2b231ca21522 (patch) | |
tree | dd89d3990a1aa6bf8be3d3f158705ed51d1d1a9a /MdeModulePkg/Universal/SetupBrowserDxe | |
parent | f9e420d5d2a41707d495e39ebed23566e2d2e9b6 (diff) | |
download | edk2-platforms-784952b1898a5a8b65143a88b56b2b231ca21522.tar.xz |
Refine code to make it more safely.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15720 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/SetupBrowserDxe')
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/Expression.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c index 3b0172d124..e8829c1855 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c @@ -1323,6 +1323,7 @@ IfrCatenate ( UINTN Size;
UINT16 Length0;
UINT16 Length1;
+ UINT8 *TmpBuf;
//
// String[0] - The second string
@@ -1378,8 +1379,12 @@ IfrCatenate ( Result->Buffer = AllocateZeroPool (Result->BufferLen);
ASSERT (Result->Buffer != NULL);
- CopyMem (Result->Buffer, GetBufferForValue(&Value[0]), Length0);
- CopyMem (&Result->Buffer[Length0], GetBufferForValue(&Value[1]), Length1);
+ TmpBuf = GetBufferForValue(&Value[0]);
+ ASSERT (TmpBuf != NULL);
+ CopyMem (Result->Buffer, TmpBuf, Length0);
+ TmpBuf = GetBufferForValue(&Value[1]);
+ ASSERT (TmpBuf != NULL);
+ CopyMem (&Result->Buffer[Length0], TmpBuf, Length1);
}
Done:
if (Value[0].Buffer != NULL) {
|