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


ssl/t1_lib.c:4079:1: start of procedure ssl_get_auto_dh()
4077.   
4078.   #ifndef OPENSSL_NO_DH
4079. > DH *ssl_get_auto_dh(SSL *s)
4080.   {
4081.       int dh_secbits = 80;

ssl/t1_lib.c:4081:5: 
4079.   DH *ssl_get_auto_dh(SSL *s)
4080.   {
4081. >     int dh_secbits = 80;
4082.       if (s->cert->dh_tmp_auto == 2)
4083.           return DH_get_1024_160();

ssl/t1_lib.c:4082:9: Taking false branch
4080.   {
4081.       int dh_secbits = 80;
4082.       if (s->cert->dh_tmp_auto == 2)
                ^
4083.           return DH_get_1024_160();
4084.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {

ssl/t1_lib.c:4084:9: Taking false branch
4082.       if (s->cert->dh_tmp_auto == 2)
4083.           return DH_get_1024_160();
4084.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
                ^
4085.           if (s->s3->tmp.new_cipher->strength_bits == 256)
4086.               dh_secbits = 128;

ssl/t1_lib.c:4090:9: 
4088.               dh_secbits = 80;
4089.       } else {
4090. >         CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4091.           dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4092.       }

ssl/ssl_lib.c:2773:1: start of procedure ssl_get_server_send_pkey()
  2771.   }
  2772.   
  2773. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s)
  2774.   {
  2775.       CERT *c;

ssl/ssl_lib.c:2778:5: 
  2776.       int i;
  2777.   
  2778. >     c = s->cert;
  2779.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2780.           return NULL;

ssl/ssl_lib.c:2779:10: Taking false branch
  2777.   
  2778.       c = s->cert;
  2779.       if (!s->s3 || !s->s3->tmp.new_cipher)
                   ^
  2780.           return NULL;
  2781.       ssl_set_masks(s);

ssl/ssl_lib.c:2779:20: Taking false branch
  2777.   
  2778.       c = s->cert;
  2779.       if (!s->s3 || !s->s3->tmp.new_cipher)
                             ^
  2780.           return NULL;
  2781.       ssl_set_masks(s);

ssl/ssl_lib.c:2781:5: Skipping ssl_set_masks(): empty list of specs
  2779.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2780.           return NULL;
  2781.       ssl_set_masks(s);
              ^
  2782.   
  2783.       i = ssl_get_server_cert_index(s);

ssl/ssl_lib.c:2783:5: 
  2781.       ssl_set_masks(s);
  2782.   
  2783. >     i = ssl_get_server_cert_index(s);
  2784.   
  2785.       /* This may or may not be an error. */

ssl/ssl_lib.c:2752:1: start of procedure ssl_get_server_cert_index()
    2750.   #endif
    2751.   
    2752. > static int ssl_get_server_cert_index(const SSL *s)
    2753.   {
    2754.       int idx;

ssl/ssl_lib.c:2755:5: 
    2753.   {
    2754.       int idx;
    2755. >     idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2756.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2757.           idx = SSL_PKEY_RSA_SIGN;

ssl/ssl_ciph.c:1979:1: start of procedure ssl_cipher_get_cert_index()
      1977.   
      1978.   /* For a cipher return the index corresponding to the certificate type */
      1979. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c)
      1980.   {
      1981.       uint32_t alg_a;

ssl/ssl_ciph.c:1983:5: 
      1981.       uint32_t alg_a;
      1982.   
      1983. >     alg_a = c->algorithm_auth;
      1984.   
      1985.       if (alg_a & SSL_aECDSA)

ssl/ssl_ciph.c:1985:9: Taking false branch
      1983.       alg_a = c->algorithm_auth;
      1984.   
      1985.       if (alg_a & SSL_aECDSA)
                      ^
      1986.           return SSL_PKEY_ECC;
      1987.       else if (alg_a & SSL_aDSS)

ssl/ssl_ciph.c:1987:14: Taking false branch
      1985.       if (alg_a & SSL_aECDSA)
      1986.           return SSL_PKEY_ECC;
      1987.       else if (alg_a & SSL_aDSS)
                           ^
      1988.           return SSL_PKEY_DSA_SIGN;
      1989.       else if (alg_a & SSL_aRSA)

ssl/ssl_ciph.c:1989:14: Taking true branch
      1987.       else if (alg_a & SSL_aDSS)
      1988.           return SSL_PKEY_DSA_SIGN;
      1989.       else if (alg_a & SSL_aRSA)
                           ^
      1990.           return SSL_PKEY_RSA_ENC;
      1991.       else if (alg_a & SSL_aGOST12)

ssl/ssl_ciph.c:1990:9: 
      1988.           return SSL_PKEY_DSA_SIGN;
      1989.       else if (alg_a & SSL_aRSA)
      1990. >         return SSL_PKEY_RSA_ENC;
      1991.       else if (alg_a & SSL_aGOST12)
      1992.           return SSL_PKEY_GOST_EC;

ssl/ssl_ciph.c:1997:1: return from a call to ssl_cipher_get_cert_index
      1995.   
      1996.       return -1;
      1997. > }
      1998.   
      1999.   const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr)

ssl/ssl_lib.c:2756:9: Taking true branch
    2754.       int idx;
    2755.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2756.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                    ^
    2757.           idx = SSL_PKEY_RSA_SIGN;
    2758.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2756:37: Taking false branch
    2754.       int idx;
    2755.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2756.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                                                ^
    2757.           idx = SSL_PKEY_RSA_SIGN;
    2758.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2758:9: Taking false branch
    2756.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2757.           idx = SSL_PKEY_RSA_SIGN;
    2758.       if (idx == SSL_PKEY_GOST_EC) {
                    ^
    2759.           if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509)
    2760.               idx = SSL_PKEY_GOST12_512;

ssl/ssl_lib.c:2768:9: Taking false branch
    2766.               idx = -1;
    2767.       }
    2768.       if (idx == -1)
                    ^
    2769.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2770.       return idx;

ssl/ssl_lib.c:2770:5: 
    2768.       if (idx == -1)
    2769.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2770. >     return idx;
    2771.   }
    2772.   

ssl/ssl_lib.c:2771:1: return from a call to ssl_get_server_cert_index
    2769.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2770.       return idx;
    2771. > }
    2772.   
    2773.   CERT_PKEY *ssl_get_server_send_pkey(SSL *s)

ssl/ssl_lib.c:2786:9: Taking true branch
  2784.   
  2785.       /* This may or may not be an error. */
  2786.       if (i < 0)
                  ^
  2787.           return NULL;
  2788.   

ssl/ssl_lib.c:2787:9: 
  2785.       /* This may or may not be an error. */
  2786.       if (i < 0)
  2787. >         return NULL;
  2788.   
  2789.       /* May be NULL. */

ssl/ssl_lib.c:2791:1: return from a call to ssl_get_server_send_pkey
  2789.       /* May be NULL. */
  2790.       return &c->pkeys[i];
  2791. > }
  2792.   
  2793.   EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher,

ssl/t1_lib.c:4091:9: 
4089.       } else {
4090.           CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4091. >         dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4092.       }
4093.   
