[openssl-commits] [openssl] OpenSSL_1_1_0-stable update

Rich Salz rsalz at openssl.org
Sat Feb 10 20:15:48 UTC 2018


The branch OpenSSL_1_1_0-stable has been updated
       via  ecd72c0028525f2f476838530e7c32bb191d3659 (commit)
      from  04f53be990f9d1d7c5f7b8f10568df6ebafccf65 (commit)


- Log -----------------------------------------------------------------
commit ecd72c0028525f2f476838530e7c32bb191d3659
Author: Rich Salz <rsalz at openssl.org>
Date:   Sat Feb 10 15:07:39 2018 -0500

    Copy name string in BIO_meth_new
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/5319)

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

Summary of changes:
 crypto/bio/bio_err.c   |  3 ++-
 crypto/bio/bio_meth.c  | 13 +++++++++----
 include/internal/bio.h |  2 +-
 include/openssl/bio.h  |  1 +
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/crypto/bio/bio_err.c b/crypto/bio/bio_err.c
index 98c90d6..c914dcf 100644
--- a/crypto/bio/bio_err.c
+++ b/crypto/bio/bio_err.c
@@ -1,6 +1,6 @@
 /*
  * Generated by util/mkerr.pl DO NOT EDIT
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -34,6 +34,7 @@ static ERR_STRING_DATA BIO_str_functs[] = {
     {ERR_FUNC(BIO_F_BIO_LISTEN), "BIO_listen"},
     {ERR_FUNC(BIO_F_BIO_LOOKUP), "BIO_lookup"},
     {ERR_FUNC(BIO_F_BIO_MAKE_PAIR), "bio_make_pair"},
+    {ERR_FUNC(BIO_F_BIO_METH_NEW), "BIO_meth_new"},
     {ERR_FUNC(BIO_F_BIO_NEW), "BIO_new"},
     {ERR_FUNC(BIO_F_BIO_NEW_FILE), "BIO_new_file"},
     {ERR_FUNC(BIO_F_BIO_NEW_MEM_BUF), "BIO_new_mem_buf"},
diff --git a/crypto/bio/bio_meth.c b/crypto/bio/bio_meth.c
index 1e2efb8..f89bba8 100644
--- a/crypto/bio/bio_meth.c
+++ b/crypto/bio/bio_meth.c
@@ -37,16 +37,21 @@ BIO_METHOD *BIO_meth_new(int type, const char *name)
 {
     BIO_METHOD *biom = OPENSSL_zalloc(sizeof(BIO_METHOD));
 
-    if (biom != NULL) {
-        biom->type = type;
-        biom->name = name;
+    if (biom == NULL
+            || (biom->name = OPENSSL_strdup(name)) == NULL) {
+        OPENSSL_free(biom);
+        BIOerr(BIO_F_BIO_METH_NEW, ERR_R_MALLOC_FAILURE);
+        return NULL;
     }
     return biom;
 }
 
 void BIO_meth_free(BIO_METHOD *biom)
 {
-    OPENSSL_free(biom);
+    if (biom != NULL) {
+        OPENSSL_free(biom->name);
+        OPENSSL_free(biom);
+    }
 }
 
 int (*BIO_meth_get_write(BIO_METHOD *biom)) (BIO *, const char *, int)
diff --git a/include/internal/bio.h b/include/internal/bio.h
index 2495acb..08ac984 100644
--- a/include/internal/bio.h
+++ b/include/internal/bio.h
@@ -11,7 +11,7 @@
 
 struct bio_method_st {
     int type;
-    const char *name;
+    char *name;
     int (*bwrite) (BIO *, const char *, int);
     int (*bread) (BIO *, char *, int);
     int (*bputs) (BIO *, const char *);
diff --git a/include/openssl/bio.h b/include/openssl/bio.h
index 7b98e9e..83eca77 100644
--- a/include/openssl/bio.h
+++ b/include/openssl/bio.h
@@ -781,6 +781,7 @@ int ERR_load_BIO_strings(void);
 # define BIO_F_BIO_LISTEN                                 139
 # define BIO_F_BIO_LOOKUP                                 135
 # define BIO_F_BIO_MAKE_PAIR                              121
+# define BIO_F_BIO_METH_NEW                               146
 # define BIO_F_BIO_NEW                                    108
 # define BIO_F_BIO_NEW_FILE                               109
 # define BIO_F_BIO_NEW_MEM_BUF                            126


More information about the openssl-commits mailing list