ssl/s3_srvr.c:2931: error: NULL_DEREFERENCE
  pointer `pkey` last assigned on line 2910 could be null and is dereferenced at line 2931, column 20.
Showing all 34 steps of the trace


ssl/s3_srvr.c:2873:1: start of procedure ssl3_get_cert_verify()
2871.   }
2872.   
2873. > int ssl3_get_cert_verify(SSL *s)
2874.   {
2875.       EVP_PKEY *pkey = NULL;

ssl/s3_srvr.c:2875:5: 
2873.   int ssl3_get_cert_verify(SSL *s)
2874.   {
2875. >     EVP_PKEY *pkey = NULL;
2876.       unsigned char *sig, *data;
2877.       int al, ok, ret = 0;

ssl/s3_srvr.c:2877:5: 
2875.       EVP_PKEY *pkey = NULL;
2876.       unsigned char *sig, *data;
2877. >     int al, ok, ret = 0;
2878.       long n;
2879.       int type = 0, i, j;

ssl/s3_srvr.c:2879:5: 
2877.       int al, ok, ret = 0;
2878.       long n;
2879. >     int type = 0, i, j;
2880.       unsigned int len;
2881.       X509 *peer;

ssl/s3_srvr.c:2882:5: 
2880.       unsigned int len;
2881.       X509 *peer;
2882. >     const EVP_MD *md = NULL;
2883.       EVP_MD_CTX mctx;
2884.       PACKET pkt;

ssl/s3_srvr.c:2885:5: 
2883.       EVP_MD_CTX mctx;
2884.       PACKET pkt;
2885. >     EVP_MD_CTX_init(&mctx);
2886.   
2887.       /*

crypto/evp/digest.c:120:1: start of procedure EVP_MD_CTX_init()
  118.   #endif
  119.   
  120. > void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
  121.   {
  122.       memset(ctx, 0, sizeof(*ctx));

crypto/evp/digest.c:122:5: 
  120.   void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
  121.   {
  122. >     memset(ctx, 0, sizeof(*ctx));
  123.   }
  124.   

crypto/evp/digest.c:123:1: return from a call to EVP_MD_CTX_init
  121.   {
  122.       memset(ctx, 0, sizeof(*ctx));
  123. > }
  124.   
  125.   EVP_MD_CTX *EVP_MD_CTX_create(void)

ssl/s3_srvr.c:2895:9: Taking false branch
2893.        * CertificateVerify state so we should not arrive here.
2894.        */
2895.       if (s->session->peer == NULL) {
                ^
2896.           ret = 1;
2897.           goto end;

ssl/s3_srvr.c:2900:5: Skipping __function_pointer__(): unresolved function pointer
2898.       }
2899.   
2900.       n = s->method->ssl_get_message(s,
            ^
2901.                                      SSL3_ST_SR_CERT_VRFY_A,
2902.                                      SSL3_ST_SR_CERT_VRFY_B,

ssl/s3_srvr.c:2906:10: Taking false branch
2904.                                      SSL3_RT_MAX_PLAIN_LENGTH, &ok);
2905.   
2906.       if (!ok)
                 ^
2907.           return ((int)n);
2908.   

ssl/s3_srvr.c:2909:5: 
2907.           return ((int)n);
2908.   
2909. >     peer = s->session->peer;
2910.       pkey = X509_get_pubkey(peer);
2911.       type = X509_certificate_type(peer, pkey);

ssl/s3_srvr.c:2910:5: 
2908.   
2909.       peer = s->session->peer;
2910. >     pkey = X509_get_pubkey(peer);
2911.       type = X509_certificate_type(peer, pkey);
2912.   

crypto/x509/x509_cmp.c:307:1: start of procedure X509_get_pubkey()
  305.   }
  306.   
  307. > EVP_PKEY *X509_get_pubkey(X509 *x)
  308.   {
  309.       if ((x == NULL) || (x->cert_info == NULL))

crypto/x509/x509_cmp.c:309:10: Taking false branch
  307.   EVP_PKEY *X509_get_pubkey(X509 *x)
  308.   {
  309.       if ((x == NULL) || (x->cert_info == NULL))
                  ^
  310.           return (NULL);
  311.       return (X509_PUBKEY_get(x->cert_info->key));

crypto/x509/x509_cmp.c:309:25: Taking true branch
  307.   EVP_PKEY *X509_get_pubkey(X509 *x)
  308.   {
  309.       if ((x == NULL) || (x->cert_info == NULL))
                                 ^
  310.           return (NULL);
  311.       return (X509_PUBKEY_get(x->cert_info->key));

crypto/x509/x509_cmp.c:310:9: 
  308.   {
  309.       if ((x == NULL) || (x->cert_info == NULL))
  310. >         return (NULL);
  311.       return (X509_PUBKEY_get(x->cert_info->key));
  312.   }

crypto/x509/x509_cmp.c:312:1: return from a call to X509_get_pubkey
  310.           return (NULL);
  311.       return (X509_PUBKEY_get(x->cert_info->key));
  312. > }
  313.   
  314.   ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)

ssl/s3_srvr.c:2911:5: Skipping X509_certificate_type(): empty list of specs
2909.       peer = s->session->peer;
2910.       pkey = X509_get_pubkey(peer);
2911.       type = X509_certificate_type(peer, pkey);
            ^
2912.   
2913.       if (!(type & EVP_PKT_SIGN)) {

ssl/s3_srvr.c:2913:11: Taking false branch
2911.       type = X509_certificate_type(peer, pkey);
2912.   
2913.       if (!(type & EVP_PKT_SIGN)) {
                  ^
2914.           SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,
2915.                  SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE);

ssl/s3_srvr.c:2921:10: 
2919.   
2920.       /* we now have a signature that we need to verify */
2921. >     if (!PACKET_buf_init(&pkt, s->init_msg, n)) {
2922.           SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
2923.           al = SSL_AD_INTERNAL_ERROR;

ssl/packet_locl.h:106:1: start of procedure PACKET_buf_init()
  104.    * is being used.
  105.    */
  106. > static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf, size_t len)
  107.   {
  108.       pkt->start = pkt->curr = buf;

ssl/packet_locl.h:108:5: 
  106.   static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf, size_t len)
  107.   {
  108. >     pkt->start = pkt->curr = buf;
  109.       pkt->end = pkt->start + len;
  110.   

ssl/packet_locl.h:109:5: 
  107.   {
  108.       pkt->start = pkt->curr = buf;
  109. >     pkt->end = pkt->start + len;
  110.   
  111.       /* Sanity checks */

ssl/packet_locl.h:112:9: Taking false branch
  110.   
  111.       /* Sanity checks */
  112.       if (pkt->start > pkt->end
                 ^
  113.               || pkt->curr < pkt->start
  114.               || pkt->curr > pkt->end

ssl/packet_locl.h:113:16: Taking false branch
  111.       /* Sanity checks */
  112.       if (pkt->start > pkt->end
  113.               || pkt->curr < pkt->start
                        ^
  114.               || pkt->curr > pkt->end
  115.               || len != (size_t)(pkt->end - pkt->start)) {

ssl/packet_locl.h:114:16: Taking false branch
  112.       if (pkt->start > pkt->end
  113.               || pkt->curr < pkt->start
  114.               || pkt->curr > pkt->end
                        ^
  115.               || len != (size_t)(pkt->end - pkt->start)) {
  116.           return 0;

ssl/packet_locl.h:115:16: Taking false branch
  113.               || pkt->curr < pkt->start
  114.               || pkt->curr > pkt->end
  115.               || len != (size_t)(pkt->end - pkt->start)) {
                        ^
  116.           return 0;
  117.       }

ssl/packet_locl.h:119:5: 
  117.       }
  118.   
  119. >     return 1;
  120.   }
  121.   

ssl/packet_locl.h:120:1: return from a call to PACKET_buf_init
  118.   
  119.       return 1;
  120. > }
  121.   
  122.   /*

ssl/s3_srvr.c:2921:10: Taking false branch
2919.   
2920.       /* we now have a signature that we need to verify */
2921.       if (!PACKET_buf_init(&pkt, s->init_msg, n)) {
                 ^
2922.           SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
2923.           al = SSL_AD_INTERNAL_ERROR;

ssl/s3_srvr.c:2931:9: Taking true branch
2929.        * length field
2930.        */
2931.       if (n == 64 && pkey->type == NID_id_GostR3410_2001) {
                ^
2932.           len = 64;
2933.       } else {

ssl/s3_srvr.c:2931:20: 
2929.        * length field
2930.        */
2931. >     if (n == 64 && pkey->type == NID_id_GostR3410_2001) {
2932.           len = 64;
2933.       } else {
