ssl/t1_lib.c:4063: error: NULL_DEREFERENCE
  pointer `cpk` last assigned on line 4062 could be null and is dereferenced at line 4063, column 45.
Showing all 30 steps of the trace


ssl/t1_lib.c:4051:1: start of procedure ssl_get_auto_dh()
4049.   
4050.   #ifndef OPENSSL_NO_DH
4051. > DH *ssl_get_auto_dh(SSL *s)
4052.   {
4053.       int dh_secbits = 80;

ssl/t1_lib.c:4053:5: 
4051.   DH *ssl_get_auto_dh(SSL *s)
4052.   {
4053. >     int dh_secbits = 80;
4054.       if (s->cert->dh_tmp_auto == 2)
4055.           return DH_get_1024_160();

ssl/t1_lib.c:4054:9: Taking false branch
4052.   {
4053.       int dh_secbits = 80;
4054.       if (s->cert->dh_tmp_auto == 2)
                ^
4055.           return DH_get_1024_160();
4056.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {

ssl/t1_lib.c:4056:9: Taking false branch
4054.       if (s->cert->dh_tmp_auto == 2)
4055.           return DH_get_1024_160();
4056.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
                ^
4057.           if (s->s3->tmp.new_cipher->strength_bits == 256)
4058.               dh_secbits = 128;

ssl/t1_lib.c:4062:9: 
4060.               dh_secbits = 80;
4061.       } else {
4062. >         CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4063.           dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4064.       }

ssl/ssl_lib.c:2644:1: start of procedure ssl_get_server_send_pkey()
  2642.   }
  2643.   
  2644. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s)
  2645.   {
  2646.       CERT *c;

ssl/ssl_lib.c:2649:5: 
  2647.       int i;
  2648.   
  2649. >     c = s->cert;
  2650.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2651.           return NULL;

ssl/ssl_lib.c:2650:10: Taking false branch
  2648.   
  2649.       c = s->cert;
  2650.       if (!s->s3 || !s->s3->tmp.new_cipher)
                   ^
  2651.           return NULL;
  2652.       ssl_set_masks(s);

ssl/ssl_lib.c:2650:20: Taking false branch
  2648.   
  2649.       c = s->cert;
  2650.       if (!s->s3 || !s->s3->tmp.new_cipher)
                             ^
  2651.           return NULL;
  2652.       ssl_set_masks(s);

ssl/ssl_lib.c:2652:5: Skipping ssl_set_masks(): empty list of specs
  2650.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2651.           return NULL;
  2652.       ssl_set_masks(s);
              ^
  2653.   
  2654.       i = ssl_get_server_cert_index(s);

ssl/ssl_lib.c:2654:5: 
  2652.       ssl_set_masks(s);
  2653.   
  2654. >     i = ssl_get_server_cert_index(s);
  2655.   
  2656.       /* This may or may not be an error. */

ssl/ssl_lib.c:2623:1: start of procedure ssl_get_server_cert_index()
    2621.   #endif
    2622.   
    2623. > static int ssl_get_server_cert_index(const SSL *s)
    2624.   {
    2625.       int idx;

ssl/ssl_lib.c:2626:5: 
    2624.   {
    2625.       int idx;
    2626. >     idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2627.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2628.           idx = SSL_PKEY_RSA_SIGN;

ssl/ssl_ciph.c:1919:1: start of procedure ssl_cipher_get_cert_index()
      1917.   
      1918.   /* For a cipher return the index corresponding to the certificate type */
      1919. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c)
      1920.   {
      1921.       uint32_t alg_a;

ssl/ssl_ciph.c:1923:5: 
      1921.       uint32_t alg_a;
      1922.   
      1923. >     alg_a = c->algorithm_auth;
      1924.   
      1925.       if (alg_a & SSL_aECDSA)

ssl/ssl_ciph.c:1925:9: Taking false branch
      1923.       alg_a = c->algorithm_auth;
      1924.   
      1925.       if (alg_a & SSL_aECDSA)
                      ^
      1926.           return SSL_PKEY_ECC;
      1927.       else if (alg_a & SSL_aDSS)

ssl/ssl_ciph.c:1927:14: Taking false branch
      1925.       if (alg_a & SSL_aECDSA)
      1926.           return SSL_PKEY_ECC;
      1927.       else if (alg_a & SSL_aDSS)
                           ^
      1928.           return SSL_PKEY_DSA_SIGN;
      1929.       else if (alg_a & SSL_aRSA)

ssl/ssl_ciph.c:1929:14: Taking true branch
      1927.       else if (alg_a & SSL_aDSS)
      1928.           return SSL_PKEY_DSA_SIGN;
      1929.       else if (alg_a & SSL_aRSA)
                           ^
      1930.           return SSL_PKEY_RSA_ENC;
      1931.       else if (alg_a & SSL_aGOST12)

ssl/ssl_ciph.c:1930:9: 
      1928.           return SSL_PKEY_DSA_SIGN;
      1929.       else if (alg_a & SSL_aRSA)
      1930. >         return SSL_PKEY_RSA_ENC;
      1931.       else if (alg_a & SSL_aGOST12)
      1932.           return SSL_PKEY_GOST_EC;

ssl/ssl_ciph.c:1937:1: return from a call to ssl_cipher_get_cert_index
      1935.   
      1936.       return -1;
      1937. > }
      1938.   
      1939.   const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr)

ssl/ssl_lib.c:2627:9: Taking true branch
    2625.       int idx;
    2626.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2627.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                    ^
    2628.           idx = SSL_PKEY_RSA_SIGN;
    2629.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2627:37: Taking false branch
    2625.       int idx;
    2626.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2627.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                                                ^
    2628.           idx = SSL_PKEY_RSA_SIGN;
    2629.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2629:9: Taking false branch
    2627.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2628.           idx = SSL_PKEY_RSA_SIGN;
    2629.       if (idx == SSL_PKEY_GOST_EC) {
                    ^
    2630.           if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509)
    2631.               idx = SSL_PKEY_GOST12_512;

ssl/ssl_lib.c:2639:9: Taking false branch
    2637.               idx = -1;
    2638.       }
    2639.       if (idx == -1)
                    ^
    2640.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2641.       return idx;

ssl/ssl_lib.c:2641:5: 
    2639.       if (idx == -1)
    2640.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2641. >     return idx;
    2642.   }
    2643.   

ssl/ssl_lib.c:2642:1: return from a call to ssl_get_server_cert_index
    2640.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2641.       return idx;
    2642. > }
    2643.   
    2644.   CERT_PKEY *ssl_get_server_send_pkey(SSL *s)

ssl/ssl_lib.c:2657:9: Taking true branch
  2655.   
  2656.       /* This may or may not be an error. */
  2657.       if (i < 0)
                  ^
  2658.           return NULL;
  2659.   

ssl/ssl_lib.c:2658:9: 
  2656.       /* This may or may not be an error. */
  2657.       if (i < 0)
  2658. >         return NULL;
  2659.   
  2660.       /* May be NULL. */

ssl/ssl_lib.c:2662:1: return from a call to ssl_get_server_send_pkey
  2660.       /* May be NULL. */
  2661.       return &c->pkeys[i];
  2662. > }
  2663.   
  2664.   EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher,

ssl/t1_lib.c:4063:9: 
4061.       } else {
4062.           CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4063. >         dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4064.       }
4065.   
