From 4c9b0a0314c8bab3c9faeac06d0aa734836b2f81 Mon Sep 17 00:00:00 2001 From: Gunnar Kudrjavets Date: Wed, 6 May 2015 10:16:55 +0100 Subject: Initialize potentially uninitialized local variables Compiling OpenSSL code with MSVC and /W4 results in a number of warnings. One category of warnings is particularly interesting - C4701 (potentially uninitialized local variable 'name' used). This warning pretty much means that there's a code path which results in uninitialized variables being used or returned. Depending on compiler, its options, OS, values in registers and/or stack, the results can be nondeterministic. Cases like this are very hard to debug so it's rational to fix these issues. This patch contains a set of trivial fixes for all the C4701 warnings (just initializing variables to 0 or NULL or appropriate error code) to make sure that deterministic values will be returned from all the execution paths. RT#3835 Signed-off-by: Matt Caswell Matt's note: All of these appear to be bogus warnings, i.e. there isn't actually a code path where an unitialised variable could be used - its just that the compiler hasn't been able to figure that out from the logic. So this commit is just about silencing spurious warnings. Reviewed-by: Rich Salz --- crypto/x509v3/v3_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crypto/x509v3/v3_conf.c') diff --git a/crypto/x509v3/v3_conf.c b/crypto/x509v3/v3_conf.c index 0997d599a9..bb1146e674 100644 --- a/crypto/x509v3/v3_conf.c +++ b/crypto/x509v3/v3_conf.c @@ -267,7 +267,7 @@ static X509_EXTENSION *v3_generic_extension(const char *ext, char *value, X509V3_CTX *ctx) { unsigned char *ext_der = NULL; - long ext_len; + long ext_len = 0; ASN1_OBJECT *obj = NULL; ASN1_OCTET_STRING *oct = NULL; X509_EXTENSION *extension = NULL; -- cgit v1.2.3