Don't attempt to memcpy a NULL pointer if the length is 0.
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24309)
return 0;
}
s->session_id_length = sid_len;
- if (sid != s->session_id)
+ if (sid != s->session_id && sid_len > 0)
memcpy(s->session_id, sid, sid_len);
+
return 1;
}