From de95d262ab448f8582b8192c3a94e9c10acdb771 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Wed, 22 Apr 2015 13:44:42 -0400 Subject: [PATCH] Add missing BUF_strdup failure checks. Change-Id: I997e8806b0bccb58fe7b8bbea4e98c68d0925361 Reviewed-on: https://boringssl-review.googlesource.com/4513 Reviewed-by: Adam Langley --- crypto/bio/connect.c | 6 ++++++ crypto/x509v3/v3_utl.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/crypto/bio/connect.c b/crypto/bio/connect.c index 82f6a7e2..1ef08ed0 100644 --- a/crypto/bio/connect.c +++ b/crypto/bio/connect.c @@ -430,11 +430,17 @@ static long conn_ctrl(BIO *bio, int cmd, long num, void *ptr) { OPENSSL_free(data->param_hostname); } data->param_hostname = BUF_strdup(ptr); + if (data->param_hostname == NULL) { + ret = 0; + } } else if (num == 1) { if (data->param_port != NULL) { OPENSSL_free(data->param_port); } data->param_port = BUF_strdup(ptr); + if (data->param_port == NULL) { + ret = 0; + } } else { ret = 0; } diff --git a/crypto/x509v3/v3_utl.c b/crypto/x509v3/v3_utl.c index f0ecc46c..27a91ffb 100644 --- a/crypto/x509v3/v3_utl.c +++ b/crypto/x509v3/v3_utl.c @@ -262,6 +262,8 @@ STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line) int state; /* We are going to modify the line so copy it first */ linebuf = BUF_strdup(line); + if (linebuf == NULL) + goto err; state = HDR_NAME; ntmp = NULL; /* Go through all characters */