Fix some missing inits
authorFdaSilvaYY <fdasilvayy@gmail.com>
Sun, 6 Mar 2016 20:26:46 +0000 (21:26 +0100)
committerFdaSilvaYY <fdasilvayy@gmail.com>
Sat, 28 May 2016 23:36:11 +0000 (01:36 +0200)
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/997)

crypto/asn1/a_strnid.c
crypto/asn1/bio_asn1.c
crypto/asn1/bio_ndef.c
crypto/asn1/tasn_scn.c
crypto/bio/bss_bio.c

index 118e0cb388e2726624b368dd632f68258e302e3e..188fa9ea260d8f520d9de64605d73144e17a4ad0 100644 (file)
@@ -213,6 +213,7 @@ static ASN1_STRING_TABLE *stable_get(int nid)
         rv->mask = tmp->mask;
         rv->flags = tmp->flags | STABLE_FLAGS_MALLOC;
     } else {
+        rv->nid = NID_undef;
         rv->minsize = -1;
         rv->maxsize = -1;
         rv->mask = 0;
index 664b68272650261a5d5132a353ed8f4bbb6c28f6..f3d4776d72c4ed585aadee150b609ebc803eb70d 100644 (file)
@@ -96,6 +96,7 @@ const BIO_METHOD *BIO_f_asn1(void)
 static int asn1_bio_new(BIO *b)
 {
     BIO_ASN1_BUF_CTX *ctx;
+
     ctx = OPENSSL_malloc(sizeof(*ctx));
     if (ctx == NULL)
         return 0;
@@ -120,10 +121,12 @@ static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size)
     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_buf = NULL;
     ctx->ex_len = 0;
+    ctx->ex_pos = 0;
     ctx->state = ASN1_STATE_START;
+    ctx->prefix = ctx->prefix_free = ctx->suffix = ctx->suffix_free = NULL;
+    ctx->ex_arg = NULL;
     return 1;
 }
 
index beeda9f89b04e6c6267d092fc8e34c3689cecb04..c43d2da4a430fd06004c3aa30e144be86b6abff2 100644 (file)
@@ -90,6 +90,7 @@ BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)
     ndef_aux->ndef_bio = sarg.ndef_bio;
     ndef_aux->boundary = sarg.boundary;
     ndef_aux->out = out;
+    ndef_aux->derbuf = NULL;
 
     BIO_ctrl(asn_bio, BIO_C_SET_EX_ARG, 0, ndef_aux);
 
index 1bdd2dfec7e35226b48219d37ba7d659689f0432..7062e2355f296607acd71bda7634af61d14cbbe7 100644 (file)
 ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb) (ASN1_SCTX *ctx))
 {
     ASN1_SCTX *ret;
+
     ret = OPENSSL_malloc(sizeof(*ret));
     if (ret == NULL) {
         ASN1err(ASN1_F_ASN1_SCTX_NEW, ERR_R_MALLOC_FAILURE);
         return NULL;
     }
+    ret->it = ret->tt = NULL;
+    ret->flags = 0;
+    ret->skidx = ret->depth = 0;
+    ret->sname = ret->fname = NULL;
+    ret->prim_type = 0;
+    ret->field = NULL;
     ret->scan_cb = scan_cb;
+    ret->app_data = NULL;
     return ret;
 }
 
index 394080dd2fd3d8b93bbfb6c54161107ad9b8d50d..9f1300e0b980c021b0bb47d243e6981d0cb2799e 100644 (file)
@@ -81,9 +81,13 @@ static int bio_new(BIO *bio)
         return 0;
 
     b->peer = NULL;
+    b->closed = 0;
+    b->len = 0;
+    b->offset = 0;
     /* enough for one TLS record (just a default) */
     b->size = 17 * 1024;
     b->buf = NULL;
+    b->request = 0;
 
     bio->ptr = b;
     return 1;