Re: [Openvpn-devel] [PATCH] auth_token.c: add NULL initialization
Am 07.01.22 um 13:35 schrieb Lev Stipakov: From: Lev Stipakov This fixes error C4703: potentially uninitialized local pointer variable 'b64output' used found by arm64 msvc compiler with SDL enabled. Not sure why this is not triggered on x86/x64. Signed-off-by: Lev Stipakov --- src/openvpn/auth_token.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvpn/auth_token.c b/src/openvpn/auth_token.c index e8875464..ceae68f6 100644 --- a/src/openvpn/auth_token.c +++ b/src/openvpn/auth_token.c @@ -259,7 +259,7 @@ generate_auth_token(const struct user_pass *up, struct tls_multi *multi) ASSERT(buf_write(, , sizeof(timestamp))); ASSERT(buf_write(, hmac_output, sizeof(hmac_output))); -char *b64output; +char *b64output = NULL; openvpn_base64_encode(BPTR(), BLEN(), ); struct buffer session_token = alloc_buf_gc( Fine with me Acked-By: Arne Schwabe ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Re: [Openvpn-devel] [PATCH] auth_token.c: add NULL initialization
Hi, On 07/01/2022 13:35, Lev Stipakov wrote: From: Lev Stipakov This fixes error C4703: potentially uninitialized local pointer variable 'b64output' used found by arm64 msvc compiler with SDL enabled. Not sure why this is not triggered on x86/x64. Signed-off-by: Lev Stipakov --- src/openvpn/auth_token.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvpn/auth_token.c b/src/openvpn/auth_token.c index e8875464..ceae68f6 100644 --- a/src/openvpn/auth_token.c +++ b/src/openvpn/auth_token.c @@ -259,7 +259,7 @@ generate_auth_token(const struct user_pass *up, struct tls_multi *multi) ASSERT(buf_write(, , sizeof(timestamp))); ASSERT(buf_write(, hmac_output, sizeof(hmac_output))); -char *b64output; +char *b64output = NULL; openvpn_base64_encode(BPTR(), BLEN(), ); It's impossible to leave b64output uninitialized, but the compiler is probably not smart enough to understand it. On the other hand, passing uninitialized variables by reference to a function (without checking its return value) and using them later is never a good pattern.. Acked-by: Antonio Quartulli -- Antonio Quartulli ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [PATCH] auth_token.c: add NULL initialization
From: Lev Stipakov This fixes error C4703: potentially uninitialized local pointer variable 'b64output' used found by arm64 msvc compiler with SDL enabled. Not sure why this is not triggered on x86/x64. Signed-off-by: Lev Stipakov --- src/openvpn/auth_token.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvpn/auth_token.c b/src/openvpn/auth_token.c index e8875464..ceae68f6 100644 --- a/src/openvpn/auth_token.c +++ b/src/openvpn/auth_token.c @@ -259,7 +259,7 @@ generate_auth_token(const struct user_pass *up, struct tls_multi *multi) ASSERT(buf_write(, , sizeof(timestamp))); ASSERT(buf_write(, hmac_output, sizeof(hmac_output))); -char *b64output; +char *b64output = NULL; openvpn_base64_encode(BPTR(), BLEN(), ); struct buffer session_token = alloc_buf_gc( -- 2.23.0.windows.1 ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel