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


ssl/t1_lib.c:4233:1: start of procedure ssl_get_auto_dh()
4231.   
4232.   #ifndef OPENSSL_NO_DH
4233. > DH *ssl_get_auto_dh(SSL *s)
4234.   {
4235.       int dh_secbits = 80;

ssl/t1_lib.c:4235:5: 
4233.   DH *ssl_get_auto_dh(SSL *s)
4234.   {
4235. >     int dh_secbits = 80;
4236.       if (s->cert->dh_tmp_auto == 2)
4237.           return DH_get_1024_160();

ssl/t1_lib.c:4236:9: Taking false branch
4234.   {
4235.       int dh_secbits = 80;
4236.       if (s->cert->dh_tmp_auto == 2)
                ^
4237.           return DH_get_1024_160();
4238.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {

ssl/t1_lib.c:4238:9: Taking false branch
4236.       if (s->cert->dh_tmp_auto == 2)
4237.           return DH_get_1024_160();
4238.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
                ^
4239.           if (s->s3->tmp.new_cipher->strength_bits == 256)
4240.               dh_secbits = 128;

ssl/t1_lib.c:4244:9: 
4242.               dh_secbits = 80;
4243.       } else {
4244. >         CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4245.           dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4246.       }

ssl/ssl_lib.c:2201:1: start of procedure ssl_get_server_send_pkey()
  2199.   }
  2200.   
  2201. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s)
  2202.   {
  2203.       CERT *c;

ssl/ssl_lib.c:2206:5: 
  2204.       int i;
  2205.   
  2206. >     c = s->cert;
  2207.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2208.           return NULL;

ssl/ssl_lib.c:2207:10: Taking false branch
  2205.   
  2206.       c = s->cert;
  2207.       if (!s->s3 || !s->s3->tmp.new_cipher)
                   ^
  2208.           return NULL;
  2209.       ssl_set_masks(s, s->s3->tmp.new_cipher);

ssl/ssl_lib.c:2207:20: Taking false branch
  2205.   
  2206.       c = s->cert;
  2207.       if (!s->s3 || !s->s3->tmp.new_cipher)
                             ^
  2208.           return NULL;
  2209.       ssl_set_masks(s, s->s3->tmp.new_cipher);

ssl/ssl_lib.c:2209:5: Skipping ssl_set_masks(): empty list of specs
  2207.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2208.           return NULL;
  2209.       ssl_set_masks(s, s->s3->tmp.new_cipher);
              ^
  2210.   
  2211.   #ifdef OPENSSL_SSL_DEBUG_BROKEN_PROTOCOL

ssl/ssl_lib.c:2220:5: 
  2218.   #endif
  2219.   
  2220. >     i = ssl_get_server_cert_index(s);
  2221.   
  2222.       /* This may or may not be an error. */

ssl/ssl_lib.c:2180:1: start of procedure ssl_get_server_cert_index()
    2178.   #endif
    2179.   
    2180. > static int ssl_get_server_cert_index(const SSL *s)
    2181.   {
    2182.       int idx;

ssl/ssl_lib.c:2183:5: 
    2181.   {
    2182.       int idx;
    2183. >     idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2184.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2185.           idx = SSL_PKEY_RSA_SIGN;

ssl/ssl_ciph.c:1949:1: start of procedure ssl_cipher_get_cert_index()
      1947.   
      1948.   /* For a cipher return the index corresponding to the certificate type */
      1949. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c)
      1950.   {
      1951.       uint32_t alg_k, alg_a;

ssl/ssl_ciph.c:1953:5: 
      1951.       uint32_t alg_k, alg_a;
      1952.   
      1953. >     alg_k = c->algorithm_mkey;
      1954.       alg_a = c->algorithm_auth;
      1955.   

ssl/ssl_ciph.c:1954:5: 
      1952.   
      1953.       alg_k = c->algorithm_mkey;
      1954. >     alg_a = c->algorithm_auth;
      1955.   
      1956.       if (alg_k & (SSL_kECDHr | SSL_kECDHe)) {

ssl/ssl_ciph.c:1956:9: Taking false branch
      1954.       alg_a = c->algorithm_auth;
      1955.   
      1956.       if (alg_k & (SSL_kECDHr | SSL_kECDHe)) {
                      ^
      1957.           /*
      1958.            * we don't need to look at SSL_kECDHE since no certificate is needed

ssl/ssl_ciph.c:1966:16: Taking false branch
      1964.            */
      1965.           return SSL_PKEY_ECC;
      1966.       } else if (alg_a & SSL_aECDSA)
                             ^
      1967.           return SSL_PKEY_ECC;
      1968.       else if (alg_a & SSL_aDSS)

ssl/ssl_ciph.c:1968:14: Taking false branch
      1966.       } else if (alg_a & SSL_aECDSA)
      1967.           return SSL_PKEY_ECC;
      1968.       else if (alg_a & SSL_aDSS)
                           ^
      1969.           return SSL_PKEY_DSA_SIGN;
      1970.       else if (alg_a & SSL_aRSA)

ssl/ssl_ciph.c:1970:14: Taking true branch
      1968.       else if (alg_a & SSL_aDSS)
      1969.           return SSL_PKEY_DSA_SIGN;
      1970.       else if (alg_a & SSL_aRSA)
                           ^
      1971.           return SSL_PKEY_RSA_ENC;
      1972.       else if (alg_a & SSL_aGOST12)

ssl/ssl_ciph.c:1971:9: 
      1969.           return SSL_PKEY_DSA_SIGN;
      1970.       else if (alg_a & SSL_aRSA)
      1971. >         return SSL_PKEY_RSA_ENC;
      1972.       else if (alg_a & SSL_aGOST12)
      1973.           return SSL_PKEY_GOST_EC;

ssl/ssl_ciph.c:1978:1: return from a call to ssl_cipher_get_cert_index
      1976.   
      1977.       return -1;
      1978. > }
      1979.   
      1980.   const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr)

ssl/ssl_lib.c:2184:9: Taking true branch
    2182.       int idx;
    2183.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2184.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                    ^
    2185.           idx = SSL_PKEY_RSA_SIGN;
    2186.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2184:37: Taking false branch
    2182.       int idx;
    2183.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2184.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                                                ^
    2185.           idx = SSL_PKEY_RSA_SIGN;
    2186.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2186:9: Taking false branch
    2184.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2185.           idx = SSL_PKEY_RSA_SIGN;
    2186.       if (idx == SSL_PKEY_GOST_EC) {
                    ^
    2187.           if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509)
    2188.               idx = SSL_PKEY_GOST12_512;

ssl/ssl_lib.c:2196:9: Taking false branch
    2194.               idx = -1;
    2195.       }
    2196.       if (idx == -1)
                    ^
    2197.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2198.       return idx;

ssl/ssl_lib.c:2198:5: 
    2196.       if (idx == -1)
    2197.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2198. >     return idx;
    2199.   }
    2200.   

ssl/ssl_lib.c:2199:1: return from a call to ssl_get_server_cert_index
    2197.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2198.       return idx;
    2199. > }
    2200.   
    2201.   CERT_PKEY *ssl_get_server_send_pkey(SSL *s)

ssl/ssl_lib.c:2223:9: Taking true branch
  2221.   
  2222.       /* This may or may not be an error. */
  2223.       if (i < 0)
                  ^
  2224.           return NULL;
  2225.   

ssl/ssl_lib.c:2224:9: 
  2222.       /* This may or may not be an error. */
  2223.       if (i < 0)
  2224. >         return NULL;
  2225.   
  2226.       /* May be NULL. */

ssl/ssl_lib.c:2228:1: return from a call to ssl_get_server_send_pkey
  2226.       /* May be NULL. */
  2227.       return &c->pkeys[i];
  2228. > }
  2229.   
  2230.   EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher,

ssl/t1_lib.c:4245:9: 
4243.       } else {
4244.           CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4245. >         dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4246.       }
4247.   
