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


ssl/t1_lib.c:4074:1: start of procedure ssl_get_auto_dh()
4072.   
4073.   #ifndef OPENSSL_NO_DH
4074. > DH *ssl_get_auto_dh(SSL *s)
4075.   {
4076.       int dh_secbits = 80;

ssl/t1_lib.c:4076:5: 
4074.   DH *ssl_get_auto_dh(SSL *s)
4075.   {
4076. >     int dh_secbits = 80;
4077.       if (s->cert->dh_tmp_auto == 2)
4078.           return DH_get_1024_160();

ssl/t1_lib.c:4077:9: Taking false branch
4075.   {
4076.       int dh_secbits = 80;
4077.       if (s->cert->dh_tmp_auto == 2)
                ^
4078.           return DH_get_1024_160();
4079.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {

ssl/t1_lib.c:4079:9: Taking false branch
4077.       if (s->cert->dh_tmp_auto == 2)
4078.           return DH_get_1024_160();
4079.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
                ^
4080.           if (s->s3->tmp.new_cipher->strength_bits == 256)
4081.               dh_secbits = 128;

ssl/t1_lib.c:4085:9: 
4083.               dh_secbits = 80;
4084.       } else {
4085. >         CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4086.           dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4087.       }

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

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

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

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

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

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

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

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

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

ssl/ssl_ciph.c:1987:5: 
      1985.       uint32_t alg_a;
      1986.   
      1987. >     alg_a = c->algorithm_auth;
      1988.   
      1989.       if (alg_a & SSL_aECDSA)

ssl/ssl_ciph.c:1989:9: Taking false branch
      1987.       alg_a = c->algorithm_auth;
      1988.   
      1989.       if (alg_a & SSL_aECDSA)
                      ^
      1990.           return SSL_PKEY_ECC;
      1991.       else if (alg_a & SSL_aDSS)

ssl/ssl_ciph.c:1991:14: Taking false branch
      1989.       if (alg_a & SSL_aECDSA)
      1990.           return SSL_PKEY_ECC;
      1991.       else if (alg_a & SSL_aDSS)
                           ^
      1992.           return SSL_PKEY_DSA_SIGN;
      1993.       else if (alg_a & SSL_aRSA)

ssl/ssl_ciph.c:1993:14: Taking true branch
      1991.       else if (alg_a & SSL_aDSS)
      1992.           return SSL_PKEY_DSA_SIGN;
      1993.       else if (alg_a & SSL_aRSA)
                           ^
      1994.           return SSL_PKEY_RSA_ENC;
      1995.       else if (alg_a & SSL_aGOST12)

ssl/ssl_ciph.c:1994:9: 
      1992.           return SSL_PKEY_DSA_SIGN;
      1993.       else if (alg_a & SSL_aRSA)
      1994. >         return SSL_PKEY_RSA_ENC;
      1995.       else if (alg_a & SSL_aGOST12)
      1996.           return SSL_PKEY_GOST_EC;

ssl/ssl_ciph.c:2001:1: return from a call to ssl_cipher_get_cert_index
      1999.   
      2000.       return -1;
      2001. > }
      2002.   
      2003.   const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr)

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

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

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

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

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

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

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

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

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

ssl/t1_lib.c:4086:9: 
4084.       } else {
4085.           CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4086. >         dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4087.       }
4088.   
