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


ssl/s3_srvr.c:2848:1: start of procedure ssl3_get_cert_verify()
2846.   }
2847.   
2848. > int ssl3_get_cert_verify(SSL *s)
2849.   {
2850.       EVP_PKEY *pkey = NULL;

ssl/s3_srvr.c:2850:5: 
2848.   int ssl3_get_cert_verify(SSL *s)
2849.   {
2850. >     EVP_PKEY *pkey = NULL;
2851.       unsigned char *sig, *data;
2852.       int al, ok, ret = 0;

ssl/s3_srvr.c:2852:5: 
2850.       EVP_PKEY *pkey = NULL;
2851.       unsigned char *sig, *data;
2852. >     int al, ok, ret = 0;
2853.       long n;
2854.       int type = 0, i, j;

ssl/s3_srvr.c:2854:5: 
2852.       int al, ok, ret = 0;
2853.       long n;
2854. >     int type = 0, i, j;
2855.       unsigned int len;
2856.       X509 *peer;

ssl/s3_srvr.c:2857:5: 
2855.       unsigned int len;
2856.       X509 *peer;
2857. >     const EVP_MD *md = NULL;
2858.       EVP_MD_CTX mctx;
2859.       PACKET pkt;

ssl/s3_srvr.c:2860:5: 
2858.       EVP_MD_CTX mctx;
2859.       PACKET pkt;
2860. >     EVP_MD_CTX_init(&mctx);
2861.   
2862.       /*

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:2870:9: Taking false branch
2868.        * CertificateVerify state so we should not arrive here.
2869.        */
2870.       if (s->session->peer == NULL) {
                ^
2871.           ret = 1;
2872.           goto end;

ssl/s3_srvr.c:2875:5: Skipping __function_pointer__(): unresolved function pointer
2873.       }
2874.   
2875.       n = s->method->ssl_get_message(s,
            ^
2876.                                      SSL3_ST_SR_CERT_VRFY_A,
2877.                                      SSL3_ST_SR_CERT_VRFY_B,

ssl/s3_srvr.c:2881:10: Taking false branch
2879.                                      SSL3_RT_MAX_PLAIN_LENGTH, &ok);
2880.   
2881.       if (!ok)
                 ^
2882.           return ((int)n);
2883.   

ssl/s3_srvr.c:2884:5: 
2882.           return ((int)n);
2883.   
2884. >     peer = s->session->peer;
2885.       pkey = X509_get_pubkey(peer);
2886.       type = X509_certificate_type(peer, pkey);

ssl/s3_srvr.c:2885:5: 
2883.   
2884.       peer = s->session->peer;
2885. >     pkey = X509_get_pubkey(peer);
2886.       type = X509_certificate_type(peer, pkey);
2887.   

crypto/x509/x509_cmp.c:305:1: start of procedure X509_get_pubkey()
  303.   }
  304.   
  305. > EVP_PKEY *X509_get_pubkey(X509 *x)
  306.   {
  307.       if (x == NULL)

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

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

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

ssl/s3_srvr.c:2886:5: Skipping X509_certificate_type(): empty list of specs
2884.       peer = s->session->peer;
2885.       pkey = X509_get_pubkey(peer);
2886.       type = X509_certificate_type(peer, pkey);
            ^
2887.   
2888.       if (!(type & EVP_PKT_SIGN)) {

ssl/s3_srvr.c:2888:11: Taking false branch
2886.       type = X509_certificate_type(peer, pkey);
2887.   
2888.       if (!(type & EVP_PKT_SIGN)) {
                  ^
2889.           SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,
2890.                  SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE);

ssl/s3_srvr.c:2896:10: 
2894.   
2895.       /* we now have a signature that we need to verify */
2896. >     if (!PACKET_buf_init(&pkt, s->init_msg, n)) {
2897.           SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
2898.           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:2896:10: Taking false branch
2894.   
2895.       /* we now have a signature that we need to verify */
2896.       if (!PACKET_buf_init(&pkt, s->init_msg, n)) {
                 ^
2897.           SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
2898.           al = SSL_AD_INTERNAL_ERROR;

ssl/s3_srvr.c:2906:9: Taking true branch
2904.        * length field
2905.        */
2906.       if (n == 64 && pkey->type == NID_id_GostR3410_2001) {
                ^
2907.           len = 64;
2908.       } else {

ssl/s3_srvr.c:2906:20: 
2904.        * length field
2905.        */
2906. >     if (n == 64 && pkey->type == NID_id_GostR3410_2001) {
2907.           len = 64;
2908.       } else {
