summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-05-01 23:10:31 -0400
committerRich Salz <rsalz@openssl.org>2015-05-04 15:00:13 -0400
commitb4faea50c35d92a67d1369355b49cc3efba78406 (patch)
treecfebea69d625f936c9fd7281f1fa3eaa2fa38834
parent8920a7cd04f43b1a090d0b0a8c9e16b94c6898d4 (diff)
Use safer sizeof variant in malloc
For a local variable: TYPE *p; Allocations like this are "risky": p = OPENSSL_malloc(sizeof(TYPE)); if the type of p changes, and the malloc call isn't updated, you could get memory corruption. Instead do this: p = OPENSSL_malloc(sizeof(*p)); Also fixed a few memset() calls that I noticed while doing this. Reviewed-by: Richard Levitte <levitte@openssl.org>
-rw-r--r--apps/apps.c9
-rw-r--r--apps/ca.c4
-rw-r--r--apps/cms.c2
-rw-r--r--apps/ecparam.c2
-rw-r--r--apps/openssl.c2
-rw-r--r--apps/s_cb.c2
-rw-r--r--apps/s_server.c6
-rw-r--r--apps/speed.c2
-rw-r--r--apps/srp.c2
-rw-r--r--apps/vms_decc_init.c2
-rw-r--r--crypto/LPdir_unix.c4
-rw-r--r--crypto/LPdir_vms.c4
-rw-r--r--crypto/LPdir_win.c4
-rw-r--r--crypto/asn1/a_object.c2
-rw-r--r--crypto/asn1/a_strnid.c2
-rw-r--r--crypto/asn1/ameth_lib.c2
-rw-r--r--crypto/asn1/asn1_lib.c2
-rw-r--r--crypto/asn1/asn_mime.c4
-rw-r--r--crypto/asn1/bio_asn1.c2
-rw-r--r--crypto/asn1/bio_ndef.c2
-rw-r--r--crypto/asn1/tasn_new.c2
-rw-r--r--crypto/asn1/tasn_prn.c2
-rw-r--r--crypto/asn1/tasn_scn.c2
-rw-r--r--crypto/asn1/x_crl.c2
-rw-r--r--crypto/asn1/x_info.c2
-rw-r--r--crypto/asn1/x_pkey.c4
-rw-r--r--crypto/bio/bf_buff.c3
-rw-r--r--crypto/bio/bf_lbuf.c2
-rw-r--r--crypto/bio/bf_nbio.c2
-rw-r--r--crypto/bio/bio_lib.c3
-rw-r--r--crypto/bio/bss_acpt.c2
-rw-r--r--crypto/bio/bss_bio.c2
-rw-r--r--crypto/bio/bss_conn.c2
-rw-r--r--crypto/bio/bss_dgram.c4
-rw-r--r--crypto/bn/Makefile14
-rw-r--r--crypto/bn/bn_blind.c2
-rw-r--r--crypto/bn/bn_ctx.c4
-rw-r--r--crypto/bn/bn_gf2m.c10
-rw-r--r--crypto/bn/bn_lib.c6
-rw-r--r--crypto/bn/bn_mont.c2
-rw-r--r--crypto/bn/bn_recp.c2
-rw-r--r--crypto/buffer/buffer.c2
-rw-r--r--crypto/cmac/cmac.c3
-rw-r--r--crypto/comp/c_zlib.c4
-rw-r--r--crypto/comp/comp_lib.c2
-rw-r--r--crypto/conf/conf_api.c2
-rw-r--r--crypto/conf/conf_def.c4
-rw-r--r--crypto/conf/conf_mod.c4
-rw-r--r--crypto/dh/dh_lib.c2
-rw-r--r--crypto/dh/dh_pmeth.c2
-rw-r--r--crypto/dsa/dsa_asn1.c2
-rw-r--r--crypto/dsa/dsa_lib.c2
-rw-r--r--crypto/dsa/dsa_pmeth.c2
-rw-r--r--crypto/dso/dso_lib.c2
-rw-r--r--crypto/dso/dso_vms.c2
-rw-r--r--crypto/dso/dso_win32.c4
-rw-r--r--crypto/ec/Makefile11
-rw-r--r--crypto/ec/ec_key.c3
-rw-r--r--crypto/ec/ec_lib.c10
-rw-r--r--crypto/ec/ec_mult.c8
-rw-r--r--crypto/ec/ec_pmeth.c3
-rw-r--r--crypto/ec/ecp_nistp224.c4
-rw-r--r--crypto/ec/ecp_nistp256.c4
-rw-r--r--crypto/ec/ecp_nistp521.c4
-rw-r--r--crypto/ec/ecp_nistz256.c4
-rw-r--r--crypto/ecdh/ech_lib.c2
-rw-r--r--crypto/ecdsa/ecs_lib.c4
-rw-r--r--crypto/engine/eng_dyn.c4
-rw-r--r--crypto/engine/eng_lib.c4
-rw-r--r--crypto/engine/eng_openssl.c2
-rw-r--r--crypto/engine/eng_table.c2
-rw-r--r--crypto/err/err.c6
-rw-r--r--crypto/evp/bio_b64.c2
-rw-r--r--crypto/evp/bio_enc.c2
-rw-r--r--crypto/evp/bio_ok.c2
-rw-r--r--crypto/evp/digest.c8
-rw-r--r--crypto/evp/evp_enc.c4
-rw-r--r--crypto/evp/evp_pbe.c3
-rw-r--r--crypto/evp/p_lib.c2
-rw-r--r--crypto/evp/pmeth_lib.c7
-rw-r--r--crypto/ex_data.c4
-rw-r--r--crypto/hmac/hm_pmeth.c2
-rw-r--r--crypto/hmac/hmac.c2
-rw-r--r--crypto/jpake/jpake.c4
-rw-r--r--crypto/lhash/lhash.c6
-rw-r--r--crypto/lock.c2
-rw-r--r--crypto/mem_dbg.c4
-rw-r--r--crypto/modes/gcm128.c2
-rw-r--r--crypto/modes/ocb128.c2
-rw-r--r--crypto/objects/Makefile8
-rw-r--r--crypto/objects/o_names.c8
-rw-r--r--crypto/objects/obj_dat.c11
-rw-r--r--crypto/objects/obj_xref.c2
-rw-r--r--crypto/ocsp/ocsp_ht.c4
-rw-r--r--crypto/pqueue/pqueue.c4
-rw-r--r--crypto/rsa/rsa_lib.c2
-rw-r--r--crypto/rsa/rsa_pmeth.c2
-rw-r--r--crypto/srp/srp_vfy.c8
-rw-r--r--crypto/stack/stack.c4
-rw-r--r--crypto/store/str_lib.c13
-rw-r--r--crypto/store/str_mem.c2
-rw-r--r--crypto/store/str_meth.c2
-rw-r--r--crypto/ts/ts_rsp_sign.c2
-rw-r--r--crypto/ts/ts_verify_ctx.c2
-rw-r--r--crypto/txt_db/txt_db.c2
-rw-r--r--crypto/ui/ui_lib.c6
-rw-r--r--crypto/x509/by_dir.c6
-rw-r--r--crypto/x509/x509_lu.c8
-rw-r--r--crypto/x509/x509_trs.c2
-rw-r--r--crypto/x509/x509_vfy.c3
-rw-r--r--crypto/x509/x509_vpm.c8
-rw-r--r--crypto/x509/x_name.c4
-rw-r--r--crypto/x509v3/pcy_cache.c2
-rw-r--r--crypto/x509v3/pcy_data.c2
-rw-r--r--crypto/x509v3/pcy_node.c2
-rw-r--r--crypto/x509v3/pcy_tree.c4
-rw-r--r--crypto/x509v3/v3_asid.c2
-rw-r--r--crypto/x509v3/v3_lib.c2
-rw-r--r--crypto/x509v3/v3_purp.c2
-rw-r--r--crypto/x509v3/v3_scts.c2
-rw-r--r--crypto/x509v3/v3_utl.c2
-rw-r--r--demos/state_machine/state_machine.c2
-rw-r--r--engines/ccgost/gost_pmeth.c7
-rw-r--r--engines/e_capi.c8
-rw-r--r--engines/e_chil.c2
-rw-r--r--engines/e_gmp.c3
-rw-r--r--ssl/bio_ssl.c3
-rw-r--r--ssl/d1_both.c2
-rw-r--r--ssl/d1_lib.c4
-rw-r--r--ssl/record/rec_layer_d1.c7
-rw-r--r--ssl/s3_enc.c4
-rw-r--r--ssl/s3_lib.c8
-rw-r--r--ssl/ssl_cert.c10
-rw-r--r--ssl/ssl_ciph.c8
-rw-r--r--ssl/ssl_conf.c4
-rw-r--r--ssl/ssl_lib.c4
-rw-r--r--