Commit 6aad9393 authored by Roberto Guimaraes's avatar Roberto Guimaraes Committed by Rich Salz
Browse files

this change will prevent undefined behavior when src and dst are equal...


this change will prevent undefined behavior when src and dst are equal (memcpy), effectively allowing setting length only in both functions.

CLA: trivial

Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2750)
parent 4f7b76bf
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -835,6 +835,7 @@ int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid,
      return 0;
    }
    s->session_id_length = sid_len;
    if (sid != s->session_id)
        memcpy(s->session_id, sid, sid_len);
    return 1;
}
@@ -921,6 +922,7 @@ int SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx,
        return 0;
    }
    s->sid_ctx_length = sid_ctx_len;
    if (sid_ctx != s->sid_ctx)
        memcpy(s->sid_ctx, sid_ctx, sid_ctx_len);

    return 1;