diff options
| author | Jiasheng Jiang <[email protected]> | 2025-06-27 20:38:19 +0200 |
|---|---|---|
| committer | Neil Horman <[email protected]> | 2025-12-28 22:56:32 +0100 |
| commit | 323e48b6fbfe5f7cf6c49aab20478ef95387bbf1 (patch) | |
| tree | 535df6c1f24594473ff25b9a629abd8b73ea0973 /demos | |
| parent | test/evp_extra_test.c: Add check for BIO_new() (diff) | |
| download | openssl-323e48b6fbfe5f7cf6c49aab20478ef95387bbf1.tar.gz openssl-323e48b6fbfe5f7cf6c49aab20478ef95387bbf1.zip | |
demos/bio/sconnect.c: Add check for BIO_new()
Add check for the return value of BIO_new() to guarantee the success.
Fixes: 0f113f3ee4 ("Run util/openssl-format-source -v -c .")
Signed-off-by: Jiasheng Jiang <[email protected]>
Reviewed-by: Dmitry Belyavskiy <[email protected]>
Reviewed-by: Frederik Wedel-Heinen <[email protected]>
Reviewed-by: Neil Horman <[email protected]>
(Merged from https://github.com/openssl/openssl/pull/27919)
Diffstat (limited to 'demos')
| -rw-r--r-- | demos/bio/sconnect.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/demos/bio/sconnect.c b/demos/bio/sconnect.c index 7cdfa401f41..e069209e726 100644 --- a/demos/bio/sconnect.c +++ b/demos/bio/sconnect.c @@ -65,10 +65,18 @@ int main(int argc, char *argv[]) /* Use it inside an SSL BIO */ ssl_bio = BIO_new(BIO_f_ssl()); + if (ssl_bio == NULL) + goto err; + BIO_set_ssl(ssl_bio, ssl, BIO_CLOSE); /* Lets use a connect BIO under the SSL BIO */ out = BIO_new(BIO_s_connect()); + if (out == NULL) { + BIO_free(ssl_bio); + goto err; + } + BIO_set_conn_hostname(out, hostport); /* The BIO has parsed the host:port and even IPv6 literals in [] */ |
