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


ssl/t1_lib.c:3968:1: start of procedure ssl_get_auto_dh()
3966.   
3967.   #ifndef OPENSSL_NO_DH
3968. > DH *ssl_get_auto_dh(SSL *s)
3969.   {
3970.       int dh_secbits = 80;

ssl/t1_lib.c:3970:5: 
3968.   DH *ssl_get_auto_dh(SSL *s)
3969.   {
3970. >     int dh_secbits = 80;
3971.       if (s->cert->dh_tmp_auto == 2)
3972.           return DH_get_1024_160();

ssl/t1_lib.c:3971:9: Taking false branch
3969.   {
3970.       int dh_secbits = 80;
3971.       if (s->cert->dh_tmp_auto == 2)
                ^
3972.           return DH_get_1024_160();
3973.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {

ssl/t1_lib.c:3973:9: Taking false branch
3971.       if (s->cert->dh_tmp_auto == 2)
3972.           return DH_get_1024_160();
3973.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
                ^
3974.           if (s->s3->tmp.new_cipher->strength_bits == 256)
3975.               dh_secbits = 128;

ssl/t1_lib.c:3979:9: 
3977.               dh_secbits = 80;
3978.       } else {
3979. >         CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
3980.           dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
3981.       }

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

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

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

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

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

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

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

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

ssl/ssl_ciph.c:1872:1: start of procedure ssl_cipher_get_cert_index()
      1870.   
      1871.   /* For a cipher return the index corresponding to the certificate type */
      1872. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c)
      1873.   {
      1874.       uint32_t alg_a;

ssl/ssl_ciph.c:1876:5: 
      1874.       uint32_t alg_a;
      1875.   
      1876. >     alg_a = c->algorithm_auth;
      1877.   
      1878.       if (alg_a & SSL_aECDSA)

ssl/ssl_ciph.c:1878:9: Taking false branch
      1876.       alg_a = c->algorithm_auth;
      1877.   
      1878.       if (alg_a & SSL_aECDSA)
                      ^
      1879.           return SSL_PKEY_ECC;
      1880.       else if (alg_a & SSL_aDSS)

ssl/ssl_ciph.c:1880:14: Taking false branch
      1878.       if (alg_a & SSL_aECDSA)
      1879.           return SSL_PKEY_ECC;
      1880.       else if (alg_a & SSL_aDSS)
                           ^
      1881.           return SSL_PKEY_DSA_SIGN;
      1882.       else if (alg_a & SSL_aRSA)

ssl/ssl_ciph.c:1882:14: Taking true branch
      1880.       else if (alg_a & SSL_aDSS)
      1881.           return SSL_PKEY_DSA_SIGN;
      1882.       else if (alg_a & SSL_aRSA)
                           ^
      1883.           return SSL_PKEY_RSA_ENC;
      1884.       else if (alg_a & SSL_aGOST12)

ssl/ssl_ciph.c:1883:9: 
      1881.           return SSL_PKEY_DSA_SIGN;
      1882.       else if (alg_a & SSL_aRSA)
      1883. >         return SSL_PKEY_RSA_ENC;
      1884.       else if (alg_a & SSL_aGOST12)
      1885.           return SSL_PKEY_GOST_EC;

ssl/ssl_ciph.c:1890:1: return from a call to ssl_cipher_get_cert_index
      1888.   
      1889.       return -1;
      1890. > }
      1891.   
      1892.   const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr)

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

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

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

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

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

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

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

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

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

ssl/t1_lib.c:3980:9: 
3978.       } else {
3979.           CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
3980. >         dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
3981.       }
3982.   
