cryptoapi.c: fix run-time check failure in msvc debugger
PATCH 1/1 cryptoapi.c: fix run-time check failure in msvc debugger
From: Lev Stipakov <[email protected]...>
When using certificate without RSA_PKCS1_PSS_PADDING padding, "saltlen" is passed unitialized to priv_enc_CNG(), which causes
Quoted 1 line
Run-Time Check Failure #3 - The variable 'saltlen' is being used without being initialized.
in VS debugger.
Initialize saltlen (and other variable for the sake of consistence) to zero to avoid above failure.
--- src/openvpn/cryptoapi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
src/openvpn/cryptoapi.c +3 -3
@@ -882,9 +882,9 @@ pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,EVP_MD *md =NULL ;const wchar_t *alg =NULL ; -int padding; -int hashlen; -int saltlen; +int padding =0 ; +int hashlen =0 ; +int saltlen =0 ; pkey =EVP_PKEY_CTX_get0_pkey (ctx);if (pkey)
Signature · 1 line
2.17.1
Hi,
Quoted 11 lines · Lev Stipakov
From: Lev Stipakov <[email protected]...>
When using certificate without
RSA_PKCS1_PSS_PADDINGpadding, "saltlen" is passed unitialized topriv_enc_CNG(), which causesQuoted 1 line
Run-Time Check Failure #3 - The variable 'saltlen' is being used without being initialized.
in VS debugger.
Initialize saltlen (and other variable for the sake of consistence) to zero
"consistency"
Quoted 14 lines
to avoid above failure.
Signed-off-by Lev Stipakov <[email protected]...>--- src/openvpn/cryptoapi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)src/openvpn/cryptoapi.c +0
-0@@ -882,9 +882,9 @@ pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,EVP_MD *md =NULL ;const wchar_t *alg =NULL ;
src/openvpn/cryptoapi.c pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, · line 890
Quoted 10 lines
src/openvpn/cryptoapi.c +3
-3-int padding; -int hashlen; -int saltlen; +int padding =0 ; +int hashlen =0 ; +int saltlen =0 ; pkey =EVP_PKEY_CTX_get0_pkey (ctx);if (pkey)
Yeah, technically it may be "undefined behaviour" to pass an uninitialized var to a function even when its not used there.
Selva
Your patch has been applied to the master branch.
(No testing done, but this is syntactically correct and does what it says on the tin)
commit e84f430f8487cf42304fe29fd8746a91309b08d0
Author: Lev Stipakov Date: Thu Feb 13 11:55:39 2020 +0200
cryptoapi.c: fix run-time check failure in msvc debugger
Signed-off-by: Lev Stipakov <[email protected]...>
Acked-by: Selva Nair <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg19410.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering