summaryrefslogtreecommitdiffstats
path: root/lib/libssl/bs_cbs.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2015-06-24 09:44:18 +0000
committerjsing <jsing@openbsd.org>2015-06-24 09:44:18 +0000
commit9b57e2683c5329a908cacd52627dfcb3f67331dc (patch)
tree5e1fb2305eddd66461014dae48e4adb2e4789fac /lib/libssl/bs_cbs.c
parentIncrement if_ipackets in if_input(). (diff)
downloadwireguard-openbsd-9b57e2683c5329a908cacd52627dfcb3f67331dc.tar.xz
wireguard-openbsd-9b57e2683c5329a908cacd52627dfcb3f67331dc.zip
Stop using BUF_memdup() within the LibreSSL code base - it is correctly
spelt malloc+memcpy, which is what is used in all except two places. ok deraadt@ doug@
Diffstat (limited to 'lib/libssl/bs_cbs.c')
-rw-r--r--lib/libssl/bs_cbs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libssl/bs_cbs.c b/lib/libssl/bs_cbs.c
index d45353a8902..ea1f0108f61 100644
--- a/lib/libssl/bs_cbs.c
+++ b/lib/libssl/bs_cbs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bs_cbs.c,v 1.16 2015/06/23 05:58:28 doug Exp $ */
+/* $OpenBSD: bs_cbs.c,v 1.17 2015/06/24 09:44:18 jsing Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
@@ -86,10 +86,11 @@ CBS_stow(const CBS *cbs, uint8_t **out_ptr, size_t *out_len)
if (cbs->len == 0)
return 1;
- *out_ptr = BUF_memdup(cbs->data, cbs->len);
- if (*out_ptr == NULL)
+ if ((*out_ptr = malloc(cbs->len)) == NULL)
return 0;
+ memcpy(*out_ptr, cbs->data, cbs->len);
+
*out_len = cbs->len;
return 1;
}