summaryrefslogtreecommitdiffstats
path: root/crypto/bio
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2018-04-26 12:06:17 -0400
committerRich Salz <rsalz@openssl.org>2018-04-26 12:27:46 -0400
commitf06080cb3da93e99755edb5f19e7ccc132aeba36 (patch)
tree5af1d6860ee8f6f8305a77190fa1f3bc4fcc336b /crypto/bio
parentd1f7a1e62a5b67b492f8e7eb48130bf00f9a3ab0 (diff)
Add missing error code when alloc-return-null
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6085)
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/bf_nbio.c4
-rw-r--r--crypto/bio/bio_err.c4
-rw-r--r--crypto/bio/bss_acpt.c4
-rw-r--r--crypto/bio/bss_conn.c4
-rw-r--r--crypto/bio/bss_log.c1
5 files changed, 14 insertions, 3 deletions
diff --git a/crypto/bio/bf_nbio.c b/crypto/bio/bf_nbio.c
index d7972bfed7..4bc84eeba6 100644
--- a/crypto/bio/bf_nbio.c
+++ b/crypto/bio/bf_nbio.c
@@ -57,8 +57,10 @@ static int nbiof_new(BIO *bi)
{
NBIO_TEST *nt;
- if ((nt = OPENSSL_zalloc(sizeof(*nt))) == NULL)
+ if ((nt = OPENSSL_zalloc(sizeof(*nt))) == NULL) {
+ BIOerr(BIO_F_NBIOF_NEW, ERR_R_MALLOC_FAILURE);
return 0;
+ }
nt->lrn = -1;
nt->lwn = -1;
bi->ptr = (char *)nt;
diff --git a/crypto/bio/bio_err.c b/crypto/bio/bio_err.c
index 2a4e478e38..7aa9dabb29 100644
--- a/crypto/bio/bio_err.c
+++ b/crypto/bio/bio_err.c
@@ -19,10 +19,12 @@ static const ERR_STRING_DATA BIO_str_functs[] = {
{ERR_PACK(ERR_LIB_BIO, BIO_F_ADDR_STRINGS, 0), "addr_strings"},
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT, 0), "BIO_accept"},
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT_EX, 0), "BIO_accept_ex"},
+ {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT_NEW, 0), "BIO_ACCEPT_new"},
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ADDR_NEW, 0), "BIO_ADDR_new"},
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_BIND, 0), "BIO_bind"},
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CALLBACK_CTRL, 0), "BIO_callback_ctrl"},
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CONNECT, 0), "BIO_connect"},
+ {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CONNECT_NEW, 0), "BIO_CONNECT_new"},
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CTRL, 0), "BIO_ctrl"},
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_GETS, 0), "BIO_gets"},
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_GET_HOST_IP, 0), "BIO_get_host_ip"},
@@ -65,6 +67,8 @@ static const ERR_STRING_DATA BIO_str_functs[] = {
{ERR_PACK(ERR_LIB_BIO, BIO_F_LINEBUFFER_CTRL, 0), "linebuffer_ctrl"},
{ERR_PACK(ERR_LIB_BIO, BIO_F_LINEBUFFER_NEW, 0), "linebuffer_new"},
{ERR_PACK(ERR_LIB_BIO, BIO_F_MEM_WRITE, 0), "mem_write"},
+ {ERR_PACK(ERR_LIB_BIO, BIO_F_NBIOF_NEW, 0), "nbiof_new"},
+ {ERR_PACK(ERR_LIB_BIO, BIO_F_SLG_WRITE, 0), "slg_write"},
{ERR_PACK(ERR_LIB_BIO, BIO_F_SSL_NEW, 0), "SSL_new"},
{0, NULL}
};
diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c
index 64cc452891..993e5903a0 100644
--- a/crypto/bio/bss_acpt.c
+++ b/crypto/bio/bss_acpt.c
@@ -92,8 +92,10 @@ static BIO_ACCEPT *BIO_ACCEPT_new(void)
{
BIO_ACCEPT *ret;
- if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
+ if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
+ BIOerr(BIO_F_BIO_ACCEPT_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
+ }
ret->accept_family = BIO_FAMILY_IPANY;
ret->accept_sock = (int)INVALID_SOCKET;
return ret;
diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c
index c87b431cdb..e9673fe783 100644
--- a/crypto/bio/bss_conn.c
+++ b/crypto/bio/bss_conn.c
@@ -223,8 +223,10 @@ BIO_CONNECT *BIO_CONNECT_new(void)
{
BIO_CONNECT *ret;
- if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
+ if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
+ BIOerr(BIO_F_BIO_CONNECT_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
+ }
ret->state = BIO_CONN_S_BEFORE;
ret->connect_family = BIO_FAMILY_IPANY;
return ret;
diff --git a/crypto/bio/bss_log.c b/crypto/bio/bss_log.c
index 10acba1dee..0376919017 100644
--- a/crypto/bio/bss_log.c
+++ b/crypto/bio/bss_log.c
@@ -197,6 +197,7 @@ static int slg_write(BIO *b, const char *in, int inl)
};
if ((buf = OPENSSL_malloc(inl + 1)) == NULL) {
+ BIOerr(BIO_F_SLG_WRITE, ERR_R_MALLOC_FAILURE);
return 0;
}
strncpy(buf, in, inl);