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


ssl/t1_lib.c:2148:1: start of procedure ssl_get_auto_dh()
2146.   
2147.   #ifndef OPENSSL_NO_DH
2148. > DH *ssl_get_auto_dh(SSL *s)
2149.   {
2150.       int dh_secbits = 80;

ssl/t1_lib.c:2150:5: 
2148.   DH *ssl_get_auto_dh(SSL *s)
2149.   {
2150. >     int dh_secbits = 80;
2151.       if (s->cert->dh_tmp_auto == 2)
2152.           return DH_get_1024_160();

ssl/t1_lib.c:2151:9: Taking false branch
2149.   {
2150.       int dh_secbits = 80;
2151.       if (s->cert->dh_tmp_auto == 2)
                ^
2152.           return DH_get_1024_160();
2153.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {

ssl/t1_lib.c:2153:9: Taking false branch
2151.       if (s->cert->dh_tmp_auto == 2)
2152.           return DH_get_1024_160();
2153.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
                ^
2154.           if (s->s3->tmp.new_cipher->strength_bits == 256)
2155.               dh_secbits = 128;

ssl/t1_lib.c:2159:9: 
2157.               dh_secbits = 80;
2158.       } else {
2159. >         CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
2160.           dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
2161.       }

ssl/ssl_lib.c:2858:1: start of procedure ssl_get_server_send_pkey()
  2856.   }
  2857.   
  2858. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s)
  2859.   {
  2860.       CERT *c;

ssl/ssl_lib.c:2863:5: 
  2861.       int i;
  2862.   
  2863. >     c = s->cert;
  2864.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2865.           return NULL;

ssl/ssl_lib.c:2864:10: Taking false branch
  2862.   
  2863.       c = s->cert;
  2864.       if (!s->s3 || !s->s3->tmp.new_cipher)
                   ^
  2865.           return NULL;
  2866.       ssl_set_masks(s);

ssl/ssl_lib.c:2864:20: Taking false branch
  2862.   
  2863.       c = s->cert;
  2864.       if (!s->s3 || !s->s3->tmp.new_cipher)
                             ^
  2865.           return NULL;
  2866.       ssl_set_masks(s);

ssl/ssl_lib.c:2866:5: Skipping ssl_set_masks(): empty list of specs
  2864.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2865.           return NULL;
  2866.       ssl_set_masks(s);
              ^
  2867.   
  2868.       i = ssl_get_server_cert_index(s);

ssl/ssl_lib.c:2868:5: 
  2866.       ssl_set_masks(s);
  2867.   
  2868. >     i = ssl_get_server_cert_index(s);
  2869.   
  2870.       /* This may or may not be an error. */

ssl/ssl_lib.c:2831:1: start of procedure ssl_get_server_cert_index()
    2829.   #endif
    2830.   
    2831. > static int ssl_get_server_cert_index(const SSL *s)
    2832.   {
    2833.       int idx;

ssl/ssl_lib.c:2840:5: 
    2838.        * forces the use of an RSA cert. This will need to change.
    2839.        */
    2840. >     idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2841.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2842.           idx = SSL_PKEY_RSA_SIGN;

ssl/ssl_ciph.c:1893:1: start of procedure ssl_cipher_get_cert_index()
      1891.   
      1892.   /* For a cipher return the index corresponding to the certificate type */
      1893. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c)
      1894.   {
      1895.       uint32_t alg_a;

ssl/ssl_ciph.c:1897:5: 
      1895.       uint32_t alg_a;
      1896.   
      1897. >     alg_a = c->algorithm_auth;
      1898.   
      1899.       if (alg_a & SSL_aECDSA)

ssl/ssl_ciph.c:1899:9: Taking false branch
      1897.       alg_a = c->algorithm_auth;
      1898.   
      1899.       if (alg_a & SSL_aECDSA)
                      ^
      1900.           return SSL_PKEY_ECC;
      1901.       else if (alg_a & SSL_aDSS)

ssl/ssl_ciph.c:1901:14: Taking false branch
      1899.       if (alg_a & SSL_aECDSA)
      1900.           return SSL_PKEY_ECC;
      1901.       else if (alg_a & SSL_aDSS)
                           ^
      1902.           return SSL_PKEY_DSA_SIGN;
      1903.       else if (alg_a & SSL_aRSA)

ssl/ssl_ciph.c:1903:14: Taking true branch
      1901.       else if (alg_a & SSL_aDSS)
      1902.           return SSL_PKEY_DSA_SIGN;
      1903.       else if (alg_a & SSL_aRSA)
                           ^
      1904.           return SSL_PKEY_RSA_ENC;
      1905.       else if (alg_a & SSL_aGOST12)

ssl/ssl_ciph.c:1904:9: 
      1902.           return SSL_PKEY_DSA_SIGN;
      1903.       else if (alg_a & SSL_aRSA)
      1904. >         return SSL_PKEY_RSA_ENC;
      1905.       else if (alg_a & SSL_aGOST12)
      1906.           return SSL_PKEY_GOST_EC;

ssl/ssl_ciph.c:1911:1: return from a call to ssl_cipher_get_cert_index
      1909.   
      1910.       return -1;
      1911. > }
      1912.   
      1913.   const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr)

ssl/ssl_lib.c:2841:9: Taking true branch
    2839.        */
    2840.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2841.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                    ^
    2842.           idx = SSL_PKEY_RSA_SIGN;
    2843.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2841:37: Taking false branch
    2839.        */
    2840.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2841.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                                                ^
    2842.           idx = SSL_PKEY_RSA_SIGN;
    2843.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2843:9: Taking false branch
    2841.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2842.           idx = SSL_PKEY_RSA_SIGN;
    2843.       if (idx == SSL_PKEY_GOST_EC) {
                    ^
    2844.           if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509)
    2845.               idx = SSL_PKEY_GOST12_512;

ssl/ssl_lib.c:2853:9: Taking false branch
    2851.               idx = -1;
    2852.       }
    2853.       if (idx == -1)
                    ^
    2854.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2855.       return idx;

ssl/ssl_lib.c:2855:5: 
    2853.       if (idx == -1)
    2854.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2855. >     return idx;
    2856.   }
    2857.   

ssl/ssl_lib.c:2856:1: return from a call to ssl_get_server_cert_index
    2854.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2855.       return idx;
    2856. > }
    2857.   
    2858.   CERT_PKEY *ssl_get_server_send_pkey(SSL *s)

ssl/ssl_lib.c:2871:9: Taking true branch
  2869.   
  2870.       /* This may or may not be an error. */
  2871.       if (i < 0)
                  ^
  2872.           return NULL;
  2873.   

ssl/ssl_lib.c:2872:9: 
  2870.       /* This may or may not be an error. */
  2871.       if (i < 0)
  2872. >         return NULL;
  2873.   
  2874.       /* May be NULL. */

ssl/ssl_lib.c:2876:1: return from a call to ssl_get_server_send_pkey
  2874.       /* May be NULL. */
  2875.       return &c->pkeys[i];
  2876. > }
  2877.   
  2878.   EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher,

ssl/t1_lib.c:2160:9: 
2158.       } else {
2159.           CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
2160. >         dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
2161.       }
2162.   
