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


ssl/t1_lib.c:4014:1: start of procedure ssl_get_auto_dh()
4012.   
4013.   #ifndef OPENSSL_NO_DH
4014. > DH *ssl_get_auto_dh(SSL *s)
4015.   {
4016.       int dh_secbits = 80;

ssl/t1_lib.c:4016:5: 
4014.   DH *ssl_get_auto_dh(SSL *s)
4015.   {
4016. >     int dh_secbits = 80;
4017.       if (s->cert->dh_tmp_auto == 2)
4018.           return DH_get_1024_160();

ssl/t1_lib.c:4017:9: Taking false branch
4015.   {
4016.       int dh_secbits = 80;
4017.       if (s->cert->dh_tmp_auto == 2)
                ^
4018.           return DH_get_1024_160();
4019.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {

ssl/t1_lib.c:4019:9: Taking false branch
4017.       if (s->cert->dh_tmp_auto == 2)
4018.           return DH_get_1024_160();
4019.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
                ^
4020.           if (s->s3->tmp.new_cipher->strength_bits == 256)
4021.               dh_secbits = 128;

ssl/t1_lib.c:4025:9: 
4023.               dh_secbits = 80;
4024.       } else {
4025. >         CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4026.           dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4027.       }

ssl/ssl_lib.c:2683:1: start of procedure ssl_get_server_send_pkey()
  2681.   }
  2682.   
  2683. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s)
  2684.   {
  2685.       CERT *c;

ssl/ssl_lib.c:2688:5: 
  2686.       int i;
  2687.   
  2688. >     c = s->cert;
  2689.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2690.           return NULL;

ssl/ssl_lib.c:2689:10: Taking false branch
  2687.   
  2688.       c = s->cert;
  2689.       if (!s->s3 || !s->s3->tmp.new_cipher)
                   ^
  2690.           return NULL;
  2691.       ssl_set_masks(s);

ssl/ssl_lib.c:2689:20: Taking false branch
  2687.   
  2688.       c = s->cert;
  2689.       if (!s->s3 || !s->s3->tmp.new_cipher)
                             ^
  2690.           return NULL;
  2691.       ssl_set_masks(s);

ssl/ssl_lib.c:2691:5: Skipping ssl_set_masks(): empty list of specs
  2689.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2690.           return NULL;
  2691.       ssl_set_masks(s);
              ^
  2692.   
  2693.       i = ssl_get_server_cert_index(s);

ssl/ssl_lib.c:2693:5: 
  2691.       ssl_set_masks(s);
  2692.   
  2693. >     i = ssl_get_server_cert_index(s);
  2694.   
  2695.       /* This may or may not be an error. */

ssl/ssl_lib.c:2662:1: start of procedure ssl_get_server_cert_index()
    2660.   #endif
    2661.   
    2662. > static int ssl_get_server_cert_index(const SSL *s)
    2663.   {
    2664.       int idx;

ssl/ssl_lib.c:2665:5: 
    2663.   {
    2664.       int idx;
    2665. >     idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2666.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2667.           idx = SSL_PKEY_RSA_SIGN;

ssl/ssl_ciph.c:1919:1: start of procedure ssl_cipher_get_cert_index()
      1917.   
      1918.   /* For a cipher return the index corresponding to the certificate type */
      1919. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c)
      1920.   {
      1921.       uint32_t alg_a;

ssl/ssl_ciph.c:1923:5: 
      1921.       uint32_t alg_a;
      1922.   
      1923. >     alg_a = c->algorithm_auth;
      1924.   
      1925.       if (alg_a & SSL_aECDSA)

ssl/ssl_ciph.c:1925:9: Taking false branch
      1923.       alg_a = c->algorithm_auth;
      1924.   
      1925.       if (alg_a & SSL_aECDSA)
                      ^
      1926.           return SSL_PKEY_ECC;
      1927.       else if (alg_a & SSL_aDSS)

ssl/ssl_ciph.c:1927:14: Taking false branch
      1925.       if (alg_a & SSL_aECDSA)
      1926.           return SSL_PKEY_ECC;
      1927.       else if (alg_a & SSL_aDSS)
                           ^
      1928.           return SSL_PKEY_DSA_SIGN;
      1929.       else if (alg_a & SSL_aRSA)

ssl/ssl_ciph.c:1929:14: Taking true branch
      1927.       else if (alg_a & SSL_aDSS)
      1928.           return SSL_PKEY_DSA_SIGN;
      1929.       else if (alg_a & SSL_aRSA)
                           ^
      1930.           return SSL_PKEY_RSA_ENC;
      1931.       else if (alg_a & SSL_aGOST12)

ssl/ssl_ciph.c:1930:9: 
      1928.           return SSL_PKEY_DSA_SIGN;
      1929.       else if (alg_a & SSL_aRSA)
      1930. >         return SSL_PKEY_RSA_ENC;
      1931.       else if (alg_a & SSL_aGOST12)
      1932.           return SSL_PKEY_GOST_EC;

ssl/ssl_ciph.c:1937:1: return from a call to ssl_cipher_get_cert_index
      1935.   
      1936.       return -1;
      1937. > }
      1938.   
      1939.   const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr)

ssl/ssl_lib.c:2666:9: Taking true branch
    2664.       int idx;
    2665.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2666.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                    ^
    2667.           idx = SSL_PKEY_RSA_SIGN;
    2668.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2666:37: Taking false branch
    2664.       int idx;
    2665.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2666.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                                                ^
    2667.           idx = SSL_PKEY_RSA_SIGN;
    2668.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2668:9: Taking false branch
    2666.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2667.           idx = SSL_PKEY_RSA_SIGN;
    2668.       if (idx == SSL_PKEY_GOST_EC) {
                    ^
    2669.           if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509)
    2670.               idx = SSL_PKEY_GOST12_512;

ssl/ssl_lib.c:2678:9: Taking false branch
    2676.               idx = -1;
    2677.       }
    2678.       if (idx == -1)
                    ^
    2679.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2680.       return idx;

ssl/ssl_lib.c:2680:5: 
    2678.       if (idx == -1)
    2679.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2680. >     return idx;
    2681.   }
    2682.   

ssl/ssl_lib.c:2681:1: return from a call to ssl_get_server_cert_index
    2679.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2680.       return idx;
    2681. > }
    2682.   
    2683.   CERT_PKEY *ssl_get_server_send_pkey(SSL *s)

ssl/ssl_lib.c:2696:9: Taking true branch
  2694.   
  2695.       /* This may or may not be an error. */
  2696.       if (i < 0)
                  ^
  2697.           return NULL;
  2698.   

ssl/ssl_lib.c:2697:9: 
  2695.       /* This may or may not be an error. */
  2696.       if (i < 0)
  2697. >         return NULL;
  2698.   
  2699.       /* May be NULL. */

ssl/ssl_lib.c:2701:1: return from a call to ssl_get_server_send_pkey
  2699.       /* May be NULL. */
  2700.       return &c->pkeys[i];
  2701. > }
  2702.   
  2703.   EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher,

ssl/t1_lib.c:4026:9: 
4024.       } else {
4025.           CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4026. >         dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4027.       }
4028.   
