diff options
author | 2020-09-16 05:52:04 +0000 | |
---|---|---|
committer | 2020-09-16 05:52:04 +0000 | |
commit | abd6eeeea8249b717a632ef673aa9a427f35fdab (patch) | |
tree | 36c7001587f9bbd525e843184cbf31107a36c1f3 /lib/libssl | |
parent | Make check in x509_verify_ctx_set_max_signatures() consistent with others. (diff) | |
download | wireguard-openbsd-abd6eeeea8249b717a632ef673aa9a427f35fdab.tar.xz wireguard-openbsd-abd6eeeea8249b717a632ef673aa9a427f35fdab.zip |
Avoid memset() before memcpy() for CBB_add_bytes().
CBB_add_bytes() calls CBB_add_space(), which now explicitly zeros memory
to avoid information leaks. However CBB_add_bytes() calls memcpy() for the
same memory region, so the memset() is unnecessary. Avoid this by inlining
part of CBB_add_space() rather than calling it directly.
ok beck@ tb@
Diffstat (limited to 'lib/libssl')
-rw-r--r-- | lib/libssl/bs_cbb.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libssl/bs_cbb.c b/lib/libssl/bs_cbb.c index d11da853cd0..e734dd68fcb 100644 --- a/lib/libssl/bs_cbb.c +++ b/lib/libssl/bs_cbb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bs_cbb.c,v 1.22 2020/03/13 15:54:34 jsing Exp $ */ +/* $OpenBSD: bs_cbb.c,v 1.23 2020/09/16 05:52:04 jsing Exp $ */ /* * Copyright (c) 2014, Google Inc. * @@ -361,7 +361,7 @@ CBB_add_bytes(CBB *cbb, const uint8_t *data, size_t len) { uint8_t *dest; - if (!CBB_add_space(cbb, &dest, len)) + if (!CBB_flush(cbb) || !cbb_buffer_add(cbb->base, &dest, len)) return 0; memcpy(dest, data, len); |