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


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

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

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

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

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

ssl/s3_srvr.c:2888:5: 
2886.       EVP_MD_CTX mctx;
2887.       PACKET pkt;
2888. >     EVP_MD_CTX_init(&mctx);
2889.   
2890.       /*

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:2898:9: Taking false branch
2896.        * CertificateVerify state so we should not arrive here.
2897.        */
2898.       if (s->session->peer == NULL) {
                ^
2899.           ret = 1;
2900.           goto end;

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

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

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

ssl/s3_srvr.c:2913:5: 
2911.   
2912.       peer = s->session->peer;
2913. >     pkey = X509_get_pubkey(peer);
2914.       type = X509_certificate_type(peer, pkey);
2915.   

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:2914:5: Skipping X509_certificate_type(): empty list of specs
2912.       peer = s->session->peer;
2913.       pkey = X509_get_pubkey(peer);
2914.       type = X509_certificate_type(peer, pkey);
            ^
2915.   
2916.       if (!(type & EVP_PKT_SIGN)) {

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

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

ssl/packet_locl.h:95:1: start of procedure PACKET_buf_init()
  93.    * is being used.
  94.    */
  95. > static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf, size_t len)
  96.   {
  97.       pkt->start = pkt->curr = buf;

ssl/packet_locl.h:97:5: 
  95.   static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf, size_t len)
  96.   {
  97. >     pkt->start = pkt->curr = buf;
  98.       pkt->end = pkt->start + len;
  99.   

ssl/packet_locl.h:98:5: 
  96.   {
  97.       pkt->start = pkt->curr = buf;
  98. >     pkt->end = pkt->start + len;
  99.   
  100.       /* Sanity checks */

ssl/packet_locl.h:101:9: Taking false branch
  99.   
  100.       /* Sanity checks */
  101.       if (pkt->start > pkt->end
                 ^
  102.               || pkt->curr < pkt->start
  103.               || pkt->curr > pkt->end

ssl/packet_locl.h:102:16: Taking false branch
  100.       /* Sanity checks */
  101.       if (pkt->start > pkt->end
  102.               || pkt->curr < pkt->start
                        ^
  103.               || pkt->curr > pkt->end
  104.               || len != (size_t)(pkt->end - pkt->start)) {

ssl/packet_locl.h:103:16: Taking false branch
  101.       if (pkt->start > pkt->end
  102.               || pkt->curr < pkt->start
  103.               || pkt->curr > pkt->end
                        ^
  104.               || len != (size_t)(pkt->end - pkt->start)) {
  105.           return 0;

ssl/packet_locl.h:104:16: Taking false branch
  102.               || pkt->curr < pkt->start
  103.               || pkt->curr > pkt->end
  104.               || len != (size_t)(pkt->end - pkt->start)) {
                        ^
  105.           return 0;
  106.       }

ssl/packet_locl.h:108:5: 
  106.       }
  107.   
  108. >     return 1;
  109.   }
  110.   

ssl/packet_locl.h:109:1: return from a call to PACKET_buf_init
  107.   
  108.       return 1;
  109. > }
  110.   
  111.   /*

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

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

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