Don't memcpy the contents of an empty fragment
authorMatt Caswell <matt@openssl.org>
Fri, 11 May 2018 09:28:47 +0000 (10:28 +0100)
committerMatt Caswell <matt@openssl.org>
Sat, 12 May 2018 09:09:59 +0000 (10:09 +0100)
commitf54b665e29a0ed8df2ea322a1f9e1b8057f13894
tree559cb24b09d73646c04d33e1461cbb2103b06250
parent18026c0215e942f0ad33a6012cb8cad2f51f841b
Don't memcpy the contents of an empty fragment

In DTLS if we have buffered a fragment for a zero length message (e.g.
ServerHelloDone) then, when we unbuffered the fragment, we were attempting
to memcpy the contents of the fragment which is zero length and a NULL
pointer. This is undefined behaviour. We should check first whether we
have a zero length fragment.

Fixes a travis issue.

[extended tests]

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6225)
ssl/d1_both.c