提交 53ba0a9e 编写于 作者: R Rich Salz 提交者: Rich Salz

RT3776: Wrong size for malloc

Use sizeof *foo parameter, to avoid these errors.
Reviewed-by: NViktor Dukhovni <viktor@openssl.org>
上级 539ed89f
......@@ -161,16 +161,16 @@ X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void)
X509_VERIFY_PARAM *param;
X509_VERIFY_PARAM_ID *paramid;
param = OPENSSL_malloc(sizeof(X509_VERIFY_PARAM));
param = OPENSSL_malloc(sizeof *param);
if (!param)
return NULL;
paramid = OPENSSL_malloc(sizeof(X509_VERIFY_PARAM));
paramid = OPENSSL_malloc(sizeof *paramid);
if (!paramid) {
OPENSSL_free(param);
return NULL;
}
memset(param, 0, sizeof(X509_VERIFY_PARAM));
memset(paramid, 0, sizeof(X509_VERIFY_PARAM_ID));
memset(param, 0, sizeof *paramid);
memset(paramid, 0, sizeof *paramid);
param->id = paramid;
x509_verify_param_zero(param);
return param;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册