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


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

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

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

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

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

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:1974:1: start of procedure ssl_cipher_get_cert_index()
      1972.   
      1973.   /* For a cipher return the index corresponding to the certificate type */
      1974. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c)
      1975.   {
      1976.       uint32_t alg_a;

ssl/ssl_ciph.c:1978:5: 
      1976.       uint32_t alg_a;
      1977.   
      1978. >     alg_a = c->algorithm_auth;
      1979.   
      1980.       if (alg_a & SSL_aECDSA)

ssl/ssl_ciph.c:1980:9: Taking false branch
      1978.       alg_a = c->algorithm_auth;
      1979.   
      1980.       if (alg_a & SSL_aECDSA)
                      ^
      1981.           return SSL_PKEY_ECC;
      1982.       else if (alg_a & SSL_aDSS)

ssl/ssl_ciph.c:1982:14: Taking false branch
      1980.       if (alg_a & SSL_aECDSA)
      1981.           return SSL_PKEY_ECC;
      1982.       else if (alg_a & SSL_aDSS)
                           ^
      1983.           return SSL_PKEY_DSA_SIGN;
      1984.       else if (alg_a & SSL_aRSA)

ssl/ssl_ciph.c:1984:14: Taking true branch
      1982.       else if (alg_a & SSL_aDSS)
      1983.           return SSL_PKEY_DSA_SIGN;
      1984.       else if (alg_a & SSL_aRSA)
                           ^
      1985.           return SSL_PKEY_RSA_ENC;
      1986.       else if (alg_a & SSL_aGOST12)

ssl/ssl_ciph.c:1985:9: 
      1983.           return SSL_PKEY_DSA_SIGN;
      1984.       else if (alg_a & SSL_aRSA)
      1985. >         return SSL_PKEY_RSA_ENC;
      1986.       else if (alg_a & SSL_aGOST12)
      1987.           return SSL_PKEY_GOST_EC;

ssl/ssl_ciph.c:1992:1: return from a call to ssl_cipher_get_cert_index
      1990.   
      1991.       return -1;
      1992. > }
      1993.   
      1994.   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:4085:9: 
4083.       } else {
4084.           CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4085. >         dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4086.       }
4087.   
