Fix an uninit read picked up by Travis
authorMatt Caswell <matt@openssl.org>
Tue, 10 Jan 2017 11:30:57 +0000 (11:30 +0000)
committerMatt Caswell <matt@openssl.org>
Tue, 10 Jan 2017 23:02:51 +0000 (23:02 +0000)
The siglen value needs to be initialised prior to it being read in the
call to EVP_DigestSignFinal later in this function.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2157)

ssl/statem/statem_srvr.c

index 0573af121ba030d577f8e126309b1054b81766d4..e2d0836b5a1b1d17d0464c6ebc7da537a5aeec35 100644 (file)
@@ -2240,8 +2240,8 @@ int tls_construct_server_key_exchange(SSL *s, WPACKET *pkt)
              * up front, and then properly allocate them in the WPACKET
              * afterwards.
              */
-            if (!WPACKET_sub_reserve_bytes_u16(pkt, EVP_PKEY_size(pkey),
-                                               &sigbytes1)
+            siglen = EVP_PKEY_size(pkey);
+            if (!WPACKET_sub_reserve_bytes_u16(pkt, siglen, &sigbytes1)
                     || EVP_DigestSignInit(md_ctx, &pctx, md, NULL, pkey) <= 0) {
                 SSLerr(SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE,
                        ERR_R_INTERNAL_ERROR);