This patch is to fix one dereferenced pointer issue in new
Pkcs7GetAttachedContent API, and add the memory allocation
failure check.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17731
6f19259b-4bc3-4df7-8a09-
765794883524
CONST UINT8 *Temp;\r
ASN1_OCTET_STRING *OctStr;\r
\r
- *Content = NULL;\r
- Pkcs7 = NULL;\r
- SignedData = NULL;\r
- OctStr = NULL;\r
-\r
//\r
// Check input parameter.\r
//\r
return FALSE;\r
}\r
\r
+ *Content = NULL;\r
+ Pkcs7 = NULL;\r
+ SignedData = NULL;\r
+ OctStr = NULL;\r
+\r
Status = WrapPkcs7Data (P7Data, P7Length, &Wrapped, &SignedData, &SignedDataSize);\r
if (!Status || (SignedDataSize > INT_MAX)) {\r
goto _Exit;\r
if ((OctStr->length > 0) && (OctStr->data != NULL)) {\r
*ContentSize = OctStr->length;\r
*Content = malloc (*ContentSize);\r
+ if (*Content == NULL) {\r
+ *ContentSize = 0;\r
+ goto _Exit;\r
+ }\r
CopyMem (*Content, OctStr->data, *ContentSize);\r
}\r
}\r