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


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

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

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

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

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

ssl/ssl_lib.c:2701:1: start of procedure ssl_get_server_send_pkey()
  2699.   }
  2700.   
  2701. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s)
  2702.   {
  2703.       CERT *c;

ssl/ssl_lib.c:2706:5: 
  2704.       int i;
  2705.   
  2706. >     c = s->cert;
  2707.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2708.           return NULL;

ssl/ssl_lib.c:2707:10: Taking false branch
  2705.   
  2706.       c = s->cert;
  2707.       if (!s->s3 || !s->s3->tmp.new_cipher)
                   ^
  2708.           return NULL;
  2709.       ssl_set_masks(s);

ssl/ssl_lib.c:2707:20: Taking false branch
  2705.   
  2706.       c = s->cert;
  2707.       if (!s->s3 || !s->s3->tmp.new_cipher)
                             ^
  2708.           return NULL;
  2709.       ssl_set_masks(s);

ssl/ssl_lib.c:2709:5: Skipping ssl_set_masks(): empty list of specs
  2707.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2708.           return NULL;
  2709.       ssl_set_masks(s);
              ^
  2710.   
  2711.       i = ssl_get_server_cert_index(s);

ssl/ssl_lib.c:2711:5: 
  2709.       ssl_set_masks(s);
  2710.   
  2711. >     i = ssl_get_server_cert_index(s);
  2712.   
  2713.       /* This may or may not be an error. */

ssl/ssl_lib.c:2680:1: start of procedure ssl_get_server_cert_index()
    2678.   #endif
    2679.   
    2680. > static int ssl_get_server_cert_index(const SSL *s)
    2681.   {
    2682.       int idx;

ssl/ssl_lib.c:2683:5: 
    2681.   {
    2682.       int idx;
    2683. >     idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2684.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2685.           idx = SSL_PKEY_RSA_SIGN;

ssl/ssl_ciph.c:1880:1: start of procedure ssl_cipher_get_cert_index()
      1878.   
      1879.   /* For a cipher return the index corresponding to the certificate type */
      1880. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c)
      1881.   {
      1882.       uint32_t alg_a;

ssl/ssl_ciph.c:1884:5: 
      1882.       uint32_t alg_a;
      1883.   
      1884. >     alg_a = c->algorithm_auth;
      1885.   
      1886.       if (alg_a & SSL_aECDSA)

ssl/ssl_ciph.c:1886:9: Taking false branch
      1884.       alg_a = c->algorithm_auth;
      1885.   
      1886.       if (alg_a & SSL_aECDSA)
                      ^
      1887.           return SSL_PKEY_ECC;
      1888.       else if (alg_a & SSL_aDSS)

ssl/ssl_ciph.c:1888:14: Taking false branch
      1886.       if (alg_a & SSL_aECDSA)
      1887.           return SSL_PKEY_ECC;
      1888.       else if (alg_a & SSL_aDSS)
                           ^
      1889.           return SSL_PKEY_DSA_SIGN;
      1890.       else if (alg_a & SSL_aRSA)

ssl/ssl_ciph.c:1890:14: Taking true branch
      1888.       else if (alg_a & SSL_aDSS)
      1889.           return SSL_PKEY_DSA_SIGN;
      1890.       else if (alg_a & SSL_aRSA)
                           ^
      1891.           return SSL_PKEY_RSA_ENC;
      1892.       else if (alg_a & SSL_aGOST12)

ssl/ssl_ciph.c:1891:9: 
      1889.           return SSL_PKEY_DSA_SIGN;
      1890.       else if (alg_a & SSL_aRSA)
      1891. >         return SSL_PKEY_RSA_ENC;
      1892.       else if (alg_a & SSL_aGOST12)
      1893.           return SSL_PKEY_GOST_EC;

ssl/ssl_ciph.c:1898:1: return from a call to ssl_cipher_get_cert_index
      1896.   
      1897.       return -1;
      1898. > }
      1899.   
      1900.   const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr)

ssl/ssl_lib.c:2684:9: Taking true branch
    2682.       int idx;
    2683.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2684.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                    ^
    2685.           idx = SSL_PKEY_RSA_SIGN;
    2686.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2684:37: Taking false branch
    2682.       int idx;
    2683.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2684.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                                                ^
    2685.           idx = SSL_PKEY_RSA_SIGN;
    2686.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2686:9: Taking false branch
    2684.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2685.           idx = SSL_PKEY_RSA_SIGN;
    2686.       if (idx == SSL_PKEY_GOST_EC) {
                    ^
    2687.           if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509)
    2688.               idx = SSL_PKEY_GOST12_512;

ssl/ssl_lib.c:2696:9: Taking false branch
    2694.               idx = -1;
    2695.       }
    2696.       if (idx == -1)
                    ^
    2697.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2698.       return idx;

ssl/ssl_lib.c:2698:5: 
    2696.       if (idx == -1)
    2697.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2698. >     return idx;
    2699.   }
    2700.   

ssl/ssl_lib.c:2699:1: return from a call to ssl_get_server_cert_index
    2697.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2698.       return idx;
    2699. > }
    2700.   
    2701.   CERT_PKEY *ssl_get_server_send_pkey(SSL *s)

ssl/ssl_lib.c:2714:9: Taking true branch
  2712.   
  2713.       /* This may or may not be an error. */
  2714.       if (i < 0)
                  ^
  2715.           return NULL;
  2716.   

ssl/ssl_lib.c:2715:9: 
  2713.       /* This may or may not be an error. */
  2714.       if (i < 0)
  2715. >         return NULL;
  2716.   
  2717.       /* May be NULL. */

ssl/ssl_lib.c:2719:1: return from a call to ssl_get_server_send_pkey
  2717.       /* May be NULL. */
  2718.       return &c->pkeys[i];
  2719. > }
  2720.   
  2721.   EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher,

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