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


ssl/t1_lib.c:4045:1: start of procedure ssl_get_auto_dh()
4043.   
4044.   #ifndef OPENSSL_NO_DH
4045. > DH *ssl_get_auto_dh(SSL *s)
4046.   {
4047.       int dh_secbits = 80;

ssl/t1_lib.c:4047:5: 
4045.   DH *ssl_get_auto_dh(SSL *s)
4046.   {
4047. >     int dh_secbits = 80;
4048.       if (s->cert->dh_tmp_auto == 2)
4049.           return DH_get_1024_160();

ssl/t1_lib.c:4048:9: Taking false branch
4046.   {
4047.       int dh_secbits = 80;
4048.       if (s->cert->dh_tmp_auto == 2)
                ^
4049.           return DH_get_1024_160();
4050.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {

ssl/t1_lib.c:4050:9: Taking false branch
4048.       if (s->cert->dh_tmp_auto == 2)
4049.           return DH_get_1024_160();
4050.       if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
                ^
4051.           if (s->s3->tmp.new_cipher->strength_bits == 256)
4052.               dh_secbits = 128;

ssl/t1_lib.c:4056:9: 
4054.               dh_secbits = 80;
4055.       } else {
4056. >         CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4057.           dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4058.       }

ssl/ssl_lib.c:2641:1: start of procedure ssl_get_server_send_pkey()
  2639.   }
  2640.   
  2641. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s)
  2642.   {
  2643.       CERT *c;

ssl/ssl_lib.c:2646:5: 
  2644.       int i;
  2645.   
  2646. >     c = s->cert;
  2647.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2648.           return NULL;

ssl/ssl_lib.c:2647:10: Taking false branch
  2645.   
  2646.       c = s->cert;
  2647.       if (!s->s3 || !s->s3->tmp.new_cipher)
                   ^
  2648.           return NULL;
  2649.       ssl_set_masks(s, s->s3->tmp.new_cipher);

ssl/ssl_lib.c:2647:20: Taking false branch
  2645.   
  2646.       c = s->cert;
  2647.       if (!s->s3 || !s->s3->tmp.new_cipher)
                             ^
  2648.           return NULL;
  2649.       ssl_set_masks(s, s->s3->tmp.new_cipher);

ssl/ssl_lib.c:2649:5: Skipping ssl_set_masks(): empty list of specs
  2647.       if (!s->s3 || !s->s3->tmp.new_cipher)
  2648.           return NULL;
  2649.       ssl_set_masks(s, s->s3->tmp.new_cipher);
              ^
  2650.   
  2651.       i = ssl_get_server_cert_index(s);

ssl/ssl_lib.c:2651:5: 
  2649.       ssl_set_masks(s, s->s3->tmp.new_cipher);
  2650.   
  2651. >     i = ssl_get_server_cert_index(s);
  2652.   
  2653.       /* This may or may not be an error. */

ssl/ssl_lib.c:2620:1: start of procedure ssl_get_server_cert_index()
    2618.   #endif
    2619.   
    2620. > static int ssl_get_server_cert_index(const SSL *s)
    2621.   {
    2622.       int idx;

ssl/ssl_lib.c:2623:5: 
    2621.   {
    2622.       int idx;
    2623. >     idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2624.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2625.           idx = SSL_PKEY_RSA_SIGN;

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

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

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

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

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

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

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

ssl/ssl_lib.c:2624:9: Taking true branch
    2622.       int idx;
    2623.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2624.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                    ^
    2625.           idx = SSL_PKEY_RSA_SIGN;
    2626.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2624:37: Taking false branch
    2622.       int idx;
    2623.       idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
    2624.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
                                                ^
    2625.           idx = SSL_PKEY_RSA_SIGN;
    2626.       if (idx == SSL_PKEY_GOST_EC) {

ssl/ssl_lib.c:2626:9: Taking false branch
    2624.       if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
    2625.           idx = SSL_PKEY_RSA_SIGN;
    2626.       if (idx == SSL_PKEY_GOST_EC) {
                    ^
    2627.           if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509)
    2628.               idx = SSL_PKEY_GOST12_512;

ssl/ssl_lib.c:2636:9: Taking false branch
    2634.               idx = -1;
    2635.       }
    2636.       if (idx == -1)
                    ^
    2637.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2638.       return idx;

ssl/ssl_lib.c:2638:5: 
    2636.       if (idx == -1)
    2637.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2638. >     return idx;
    2639.   }
    2640.   

ssl/ssl_lib.c:2639:1: return from a call to ssl_get_server_cert_index
    2637.           SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
    2638.       return idx;
    2639. > }
    2640.   
    2641.   CERT_PKEY *ssl_get_server_send_pkey(SSL *s)

ssl/ssl_lib.c:2654:9: Taking true branch
  2652.   
  2653.       /* This may or may not be an error. */
  2654.       if (i < 0)
                  ^
  2655.           return NULL;
  2656.   

ssl/ssl_lib.c:2655:9: 
  2653.       /* This may or may not be an error. */
  2654.       if (i < 0)
  2655. >         return NULL;
  2656.   
  2657.       /* May be NULL. */

ssl/ssl_lib.c:2659:1: return from a call to ssl_get_server_send_pkey
  2657.       /* May be NULL. */
  2658.       return &c->pkeys[i];
  2659. > }
  2660.   
  2661.   EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher,

ssl/t1_lib.c:4057:9: 
4055.       } else {
4056.           CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4057. >         dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4058.       }
4059.   
