]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix clang compile time error
authorTodd Short <tshort@akamai.com>
Wed, 3 May 2017 14:26:17 +0000 (10:26 -0400)
committerRichard Levitte <levitte@openssl.org>
Thu, 4 May 2017 03:37:30 +0000 (05:37 +0200)
|version| "could" be used uninitialized here, not really, but the
compiler doesn't understand the flow

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3373)

ssl/ssl_rsa.c

index f0a058e4bc5c2f6d74b744839051f7439479c262..c3f27161f4dc153c4455098a6c8d3ae457e42117 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <stdio.h>
+#include <assert.h>
 #include "ssl_locl.h"
 #include "packet_locl.h"
 #include <openssl/bio.h>
@@ -903,7 +904,7 @@ int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file)
     int ret = 0;
     BIO *bin = NULL;
     size_t num_extensions = 0, contextoff = 0;
-    unsigned int version;
+    unsigned int version = 0;
 
     if (ctx == NULL || file == NULL) {
         SSLerr(SSL_F_SSL_CTX_USE_SERVERINFO_FILE, ERR_R_PASSED_NULL_PARAMETER);
@@ -1009,8 +1010,10 @@ int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file)
         extension = NULL;
     }
 
-    ret = SSL_CTX_use_serverinfo_ex(ctx, version, serverinfo,
-                                    serverinfo_length);
+    assert(version != 0);
+    if (version != 0)
+        ret = SSL_CTX_use_serverinfo_ex(ctx, version, serverinfo,
+                                        serverinfo_length);
  end:
     /* SSL_CTX_use_serverinfo makes a local copy of the serverinfo. */
     OPENSSL_free(name);