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


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

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

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

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

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

ssl/ssl_lib.c:2766:1: start of procedure ssl_get_server_send_pkey()
  2764.   }
  2765.   
  2766. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s)
  2767.   {
  2768.       CERT *c;

ssl/ssl_lib.c:2771:5: 
  2769.       int i;
  2770.   
  2771. >     c = s->cert;
  2772.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2773.           return NULL;

ssl/ssl_lib.c:2772:10: Taking false branch
  2770.   
  2771.       c = s->cert;
  2772.       if (!s->s3 || !s->s3->tmp.new_cipher)
                   ^
  2773.           return NULL;
  2774.       ssl_set_masks(s);

ssl/ssl_lib.c:2772:20: Taking false branch
  2770.   
  2771.       c = s->cert;
  2772.       if (!s->s3 || !s->s3->tmp.new_cipher)
                             ^
  2773.           return NULL;
  2774.       ssl_set_masks(s);

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

ssl/ssl_lib.c:2776:5: 
  2774.       ssl_set_masks(s);
  2775.   
  2776. >     i = ssl_get_server_cert_index(s);
  2777.   
  2778.       /* This may or may not be an error. */

ssl/ssl_lib.c:2745:1: start of procedure ssl_get_server_cert_index()
    2743.   #endif
    2744.   
    2745. > static int ssl_get_server_cert_index(const SSL *s)
    2746.   {
    2747.       int idx;

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

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

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

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

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

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

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

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

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

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

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

ssl/ssl_lib.c:2761:9: Taking false branch
    2759.               idx = -1;
    2760.       }
    2761.       if (idx == -1)
                    ^
    2762.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2763.       return idx;

ssl/ssl_lib.c:2763:5: 
    2761.       if (idx == -1)
    2762.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2763. >     return idx;
    2764.   }
    2765.   

ssl/ssl_lib.c:2764:1: return from a call to ssl_get_server_cert_index
    2762.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2763.       return idx;
    2764. > }
    2765.   
    2766.   CERT_PKEY *ssl_get_server_send_pkey(SSL *s)

ssl/ssl_lib.c:2779:9: Taking true branch
  2777.   
  2778.       /* This may or may not be an error. */
  2779.       if (i < 0)
                  ^
  2780.           return NULL;
  2781.   

ssl/ssl_lib.c:2780:9: 
  2778.       /* This may or may not be an error. */
  2779.       if (i < 0)
  2780. >         return NULL;
  2781.   
  2782.       /* May be NULL. */

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

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