summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src/ssl/d1_both.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2014-04-30 13:51:58 +0000
committerjsing <jsing@openbsd.org>2014-04-30 13:51:58 +0000
commit5071407dbedd4bba77fcb54f04a84b73d450244b (patch)
treec026fa67df3343ef66e54b2a118c7b2dfcd15b2e /lib/libssl/src/ssl/d1_both.c
parentFirst pass at removing win64 support from the assembly generating Perl (diff)
downloadwireguard-openbsd-5071407dbedd4bba77fcb54f04a84b73d450244b.tar.xz
wireguard-openbsd-5071407dbedd4bba77fcb54f04a84b73d450244b.zip
Avoid a potential null pointer dereference by checking that we actually
managed to allocate a fragment, before trying to memcpy data into it. ok miod@
Diffstat (limited to 'lib/libssl/src/ssl/d1_both.c')
-rw-r--r--lib/libssl/src/ssl/d1_both.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libssl/src/ssl/d1_both.c b/lib/libssl/src/ssl/d1_both.c
index 7762ccdee61..db57bf9d3d5 100644
--- a/lib/libssl/src/ssl/d1_both.c
+++ b/lib/libssl/src/ssl/d1_both.c
@@ -1137,6 +1137,8 @@ dtls1_buffer_message(SSL *s, int is_ccs)
OPENSSL_assert(s->init_off == 0);
frag = dtls1_hm_fragment_new(s->init_num, 0);
+ if (frag == NULL)
+ return 0;
memcpy(frag->fragment, s->init_buf->data, s->init_num);