[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Sun May 29 02:39:22 UTC 2016


The branch master has been updated
       via  f59f23c38331e3adf58c0317caf319a7bfd82dd1 (commit)
       via  8e89e85f556f549f05d3b49f5408a217ac5e3700 (commit)
      from  8640f21093ae02c838e183f04ea52f781b5c98d6 (commit)


- Log -----------------------------------------------------------------
commit f59f23c38331e3adf58c0317caf319a7bfd82dd1
Author: FdaSilvaYY <fdasilvayy at gmail.com>
Date:   Sun Mar 6 21:40:58 2016 +0100

    Add more zalloc
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/997)

commit 8e89e85f556f549f05d3b49f5408a217ac5e3700
Author: FdaSilvaYY <fdasilvayy at gmail.com>
Date:   Sun Mar 6 21:26:46 2016 +0100

    Fix some missing inits
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/997)

-----------------------------------------------------------------------

Summary of changes:
 crypto/asn1/a_strnid.c |  3 +--
 crypto/asn1/bio_asn1.c | 10 ++--------
 crypto/asn1/bio_ndef.c |  8 ++++----
 crypto/asn1/tasn_scn.c |  4 ++--
 crypto/bio/bss_bio.c   |  5 +----
 5 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/crypto/asn1/a_strnid.c b/crypto/asn1/a_strnid.c
index 118e0cb..53832c8 100644
--- a/crypto/asn1/a_strnid.c
+++ b/crypto/asn1/a_strnid.c
@@ -199,7 +199,7 @@ static ASN1_STRING_TABLE *stable_get(int nid)
     tmp = ASN1_STRING_TABLE_get(nid);
     if (tmp && tmp->flags & STABLE_FLAGS_MALLOC)
         return tmp;
-    rv = OPENSSL_malloc(sizeof(*rv));
+    rv = OPENSSL_zalloc(sizeof(*rv));
     if (rv == NULL)
         return NULL;
     if (!sk_ASN1_STRING_TABLE_push(stable, rv)) {
@@ -215,7 +215,6 @@ static ASN1_STRING_TABLE *stable_get(int nid)
     } else {
         rv->minsize = -1;
         rv->maxsize = -1;
-        rv->mask = 0;
         rv->flags = STABLE_FLAGS_MALLOC;
     }
     return rv;
diff --git a/crypto/asn1/bio_asn1.c b/crypto/asn1/bio_asn1.c
index 664b682..400effa 100644
--- a/crypto/asn1/bio_asn1.c
+++ b/crypto/asn1/bio_asn1.c
@@ -95,8 +95,8 @@ const BIO_METHOD *BIO_f_asn1(void)
 
 static int asn1_bio_new(BIO *b)
 {
-    BIO_ASN1_BUF_CTX *ctx;
-    ctx = OPENSSL_malloc(sizeof(*ctx));
+    BIO_ASN1_BUF_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
+
     if (ctx == NULL)
         return 0;
     if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE)) {
@@ -115,14 +115,8 @@ static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size)
     if (ctx->buf == NULL)
         return 0;
     ctx->bufsize = size;
-    ctx->bufpos = 0;
-    ctx->buflen = 0;
-    ctx->copylen = 0;
     ctx->asn1_class = V_ASN1_UNIVERSAL;
     ctx->asn1_tag = V_ASN1_OCTET_STRING;
-    ctx->ex_buf = 0;
-    ctx->ex_pos = 0;
-    ctx->ex_len = 0;
     ctx->state = ASN1_STATE_START;
     return 1;
 }
diff --git a/crypto/asn1/bio_ndef.c b/crypto/asn1/bio_ndef.c
index beeda9f..0f206b2 100644
--- a/crypto/asn1/bio_ndef.c
+++ b/crypto/asn1/bio_ndef.c
@@ -60,14 +60,14 @@ BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)
         ASN1err(ASN1_F_BIO_NEW_NDEF, ASN1_R_STREAMING_NOT_SUPPORTED);
         return NULL;
     }
-    ndef_aux = OPENSSL_malloc(sizeof(*ndef_aux));
+    ndef_aux = OPENSSL_zalloc(sizeof(*ndef_aux));
     asn_bio = BIO_new(BIO_f_asn1());
+    if (ndef_aux == NULL || asn_bio == NULL)
+        goto err;
 
     /* ASN1 bio needs to be next to output BIO */
-
     out = BIO_push(asn_bio, out);
-
-    if (ndef_aux == NULL || asn_bio == NULL || !out)
+    if (out == NULL)
         goto err;
 
     BIO_asn1_set_prefix(asn_bio, ndef_prefix, ndef_prefix_free);
diff --git a/crypto/asn1/tasn_scn.c b/crypto/asn1/tasn_scn.c
index 1bdd2df..e1df2cf 100644
--- a/crypto/asn1/tasn_scn.c
+++ b/crypto/asn1/tasn_scn.c
@@ -24,8 +24,8 @@
 
 ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb) (ASN1_SCTX *ctx))
 {
-    ASN1_SCTX *ret;
-    ret = OPENSSL_malloc(sizeof(*ret));
+    ASN1_SCTX *ret = OPENSSL_zalloc(sizeof(*ret));
+
     if (ret == NULL) {
         ASN1err(ASN1_F_ASN1_SCTX_NEW, ERR_R_MALLOC_FAILURE);
         return NULL;
diff --git a/crypto/bio/bss_bio.c b/crypto/bio/bss_bio.c
index 394080d..de34f6b 100644
--- a/crypto/bio/bss_bio.c
+++ b/crypto/bio/bss_bio.c
@@ -74,16 +74,13 @@ struct bio_bio_st {
 
 static int bio_new(BIO *bio)
 {
-    struct bio_bio_st *b;
+    struct bio_bio_st *b = OPENSSL_zalloc(sizeof(*b));
 
-    b = OPENSSL_malloc(sizeof(*b));
     if (b == NULL)
         return 0;
 
-    b->peer = NULL;
     /* enough for one TLS record (just a default) */
     b->size = 17 * 1024;
-    b->buf = NULL;
 
     bio->ptr = b;
     return 1;


More information about the openssl-commits mailing list