diff options
author | Kurt Roeckx <kurt@roeckx.be> | 2016-12-08 19:20:55 +0100 |
---|---|---|
committer | Kurt Roeckx <kurt@roeckx.be> | 2016-12-08 20:17:01 +0100 |
commit | a19fc66a6b5f99ad00305e152bdb41460d728640 (patch) | |
tree | 778239e2a8d6a281f80e8e68b78930e968aeefca | |
parent | 120fb9e43656e1801c75a4fbb7c178ebec9bac18 (diff) |
Only call memcpy when the length is larger than 0.
Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #2050
-rw-r--r-- | ssl/statem/statem_clnt.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ssl/statem/statem_clnt.c b/ssl/statem/statem_clnt.c index 35ca8defa9..9b9d6cd6c7 100644 --- a/ssl/statem/statem_clnt.c +++ b/ssl/statem/statem_clnt.c @@ -1186,8 +1186,9 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt) s->session->ssl_version = s->version; s->session->session_id_length = session_id_len; /* session_id_len could be 0 */ - memcpy(s->session->session_id, PACKET_data(&session_id), - session_id_len); + if (session_id_len > 0) + memcpy(s->session->session_id, PACKET_data(&session_id), + session_id_len); } /* Session version and negotiated protocol version should match */ |