]> granicus.if.org Git - openssl/commitdiff
RT3776: Wrong size for malloc
authorRich Salz <rsalz@akamai.com>
Sat, 2 May 2015 02:06:07 +0000 (22:06 -0400)
committerRich Salz <rsalz@openssl.org>
Sat, 2 May 2015 11:54:03 +0000 (07:54 -0400)
Use sizeof *foo parameter, to avoid these errors.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
crypto/x509/x509_vpm.c

index 29ee8a738f42a216b1ff7411a2110f86131f34a2..6305406756f69686639379343a246aaa023660cf 100644 (file)
@@ -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;