提交 f84a648c 编写于 作者: K KaoruToda 提交者: Andy Polyakov

apps/s_client.c: add missing null check

apps/s_server.c: remove unnecessary null check
Reviewed-by: NRich Salz <rsalz@openssl.org>
Reviewed-by: NAndy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4558)
上级 0c1aaa24
...@@ -1866,6 +1866,9 @@ int s_client_main(int argc, char **argv) ...@@ -1866,6 +1866,9 @@ int s_client_main(int argc, char **argv)
goto end; goto end;
con = SSL_new(ctx); con = SSL_new(ctx);
if (con == NULL)
goto end;
if (sess_in != NULL) { if (sess_in != NULL) {
SSL_SESSION *sess; SSL_SESSION *sess;
BIO *stmp = BIO_new_file(sess_in, "r"); BIO *stmp = BIO_new_file(sess_in, "r");
......
...@@ -2202,22 +2202,25 @@ static int sv_body(int s, int stype, int prot, unsigned char *context) ...@@ -2202,22 +2202,25 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
BIO_printf(bio_err, "Turned on non blocking io\n"); BIO_printf(bio_err, "Turned on non blocking io\n");
} }
con = SSL_new(ctx);
if (con == NULL) { if (con == NULL) {
con = SSL_new(ctx); ret = -1;
goto err;
}
if (s_tlsextdebug) { if (s_tlsextdebug) {
SSL_set_tlsext_debug_callback(con, tlsext_cb); SSL_set_tlsext_debug_callback(con, tlsext_cb);
SSL_set_tlsext_debug_arg(con, bio_s_out); SSL_set_tlsext_debug_arg(con, bio_s_out);
} }
if (context if (context != NULL
&& !SSL_set_session_id_context(con, && !SSL_set_session_id_context(con, context,
context, strlen((char *)context))) { strlen((char *)context))) {
BIO_printf(bio_err, "Error setting session id context\n"); BIO_printf(bio_err, "Error setting session id context\n");
ret = -1; ret = -1;
goto err; goto err;
}
} }
if (!SSL_clear(con)) { if (!SSL_clear(con)) {
BIO_printf(bio_err, "Error clearing SSL connection\n"); BIO_printf(bio_err, "Error clearing SSL connection\n");
ret = -1; ret = -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册