Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24673)
dest = OPENSSL_malloc(sizeof(*dest));
if (dest == NULL)
return NULL;
- memcpy(dest, src, sizeof(*dest));
+
+ /*
+ * Copy until prev ptr, because it's a part of sessons cache which can be modified
+ * concurrently. Other fields filled in the code bellow.
+ */
+ memcpy(dest, src, offsetof(SSL_SESSION, prev));
+ dest->ext = src->ext;
+ dest->ticket_appdata_len = src->ticket_appdata_len;
+ dest->flags = src->flags;
/*
* Set the various pointers to NULL so that we can call SSL_SESSION_free in