Instead of writing at the end of the metadata buffer, the decoded base64 data overwrites the opcode as BPTR points to the beginning of the buffer and not the current position. Replace with BEND to fix this off-by-one
Signed-off-by: Arne Schwabe <a...@rfc2549.org> --- src/openvpn/tls_crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvpn/tls_crypt.c b/src/openvpn/tls_crypt.c index 37df2ce7..e9f9cc2a 100644 --- a/src/openvpn/tls_crypt.c +++ b/src/openvpn/tls_crypt.c @@ -664,7 +664,7 @@ tls_crypt_v2_write_client_key_file(const char *filename, (int)strlen(b64_metadata), TLS_CRYPT_V2_MAX_B64_METADATA_LEN); } ASSERT(buf_write(&metadata, &TLS_CRYPT_METADATA_TYPE_USER, 1)); - int decoded_len = openvpn_base64_decode(b64_metadata, BPTR(&metadata), + int decoded_len = openvpn_base64_decode(b64_metadata, BEND(&metadata), BCAP(&metadata)); if (decoded_len < 0) { -- 2.26.0 _______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel