]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c
1. Fix build break issue for NOOPT target.
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / Pem / CryptPem.c
index e9de39a1058a1983856d97572a3679115583759f..ed53b2dcbf738ee9ec288054ebad55593eeb9e05 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   PEM (Privacy Enhanced Mail) Format Handler Wrapper Implementation over OpenSSL.\r
 \r
-Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -41,9 +41,9 @@ PasswordCallback (
     //\r
     // Duplicate key phrase directly.\r
     //\r
-    KeyLength = AsciiStrLen ((CHAR8 *)Key);\r
+    KeyLength = (INTN) AsciiStrLen ((CHAR8 *)Key);\r
     KeyLength = (KeyLength > Size ) ? Size : KeyLength;\r
-    CopyMem (Buf, Key, KeyLength);\r
+    CopyMem (Buf, Key, (UINTN) KeyLength);\r
     return KeyLength;\r
   } else {\r
     return 0;\r
@@ -85,6 +85,10 @@ RsaGetPrivateKeyFromPem (
   ASSERT (PemData    != NULL);\r
   ASSERT (RsaContext != NULL);\r
 \r
+  if (PemSize > INT_MAX) {\r
+    return FALSE;\r
+  }\r
+\r
   Status = FALSE;\r
   PemBio = NULL;\r
 \r