From: Max Fillinger <[email protected]> After generating a tls-crypt-v2 client key, OpenVPN will try to load the generated key to verify that it was generated correctly. If the client key is not written to disk but printed out on the command line, the PEM encoded key is stored in memory and read_pem_key_file is called with key_file_inline = true. However, this key is not a null-terminated string, so we end up calling strlen on a buffer that isn't null-terminated.
This commit adds a null-byte at the end of the key. Change-Id: I2ca8bf90a796f2b757c2fde0ae24468ef3abc3b5 Signed-off-by: Max Fillinger <[email protected]> Acked-by: Gert Doering <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1701 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1701 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering <[email protected]> diff --git a/src/openvpn/tls_crypt.c b/src/openvpn/tls_crypt.c index e91f80c..8c3d722 100644 --- a/src/openvpn/tls_crypt.c +++ b/src/openvpn/tls_crypt.c @@ -758,9 +758,10 @@ if (!filename || streq(filename, "")) { - printf("%.*s\n", BLEN(&client_key_pem), BPTR(&client_key_pem)); + buf_null_terminate(&client_key_pem); client_file = (const char *)BPTR(&client_key_pem); client_inline = true; + printf("%s\n", client_file); } else if (!buffer_write_file(filename, &client_key_pem)) { _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
