ssl/s3_srvr.c:2121: error: NULL_DEREFERENCE
  pointer `clnt_pub_pkey` last assigned on line 1617 could be null and is dereferenced by call to `EVP_PKEY_free()` at line 2121, column 2.
Showing all 38 steps of the trace


ssl/s3_srvr.c:1597:1: start of procedure ssl3_get_client_key_exchange()
1595.   	}
1596.   
1597. > static int ssl3_get_client_key_exchange(SSL *s)
1598.   	{
1599.   	int i,al,ok;

ssl/s3_srvr.c:1604:2: 
1602.   	unsigned char *p;
1603.   #ifndef OPENSSL_NO_RSA
1604. > 	RSA *rsa=NULL;
1605.   	EVP_PKEY *pkey=NULL;
1606.   #endif

ssl/s3_srvr.c:1605:2: 
1603.   #ifndef OPENSSL_NO_RSA
1604.   	RSA *rsa=NULL;
1605. > 	EVP_PKEY *pkey=NULL;
1606.   #endif
1607.   #ifndef OPENSSL_NO_DH

ssl/s3_srvr.c:1608:2: 
1606.   #endif
1607.   #ifndef OPENSSL_NO_DH
1608. > 	BIGNUM *pub=NULL;
1609.   	DH *dh_srvr;
1610.   #endif

ssl/s3_srvr.c:1616:2: 
1614.   
1615.   #ifndef OPENSSL_NO_ECDH
1616. > 	EC_KEY *srvr_ecdh = NULL;
1617.   	EVP_PKEY *clnt_pub_pkey = NULL;
1618.   	EC_POINT *clnt_ecpoint = NULL;

ssl/s3_srvr.c:1617:2: 
1615.   #ifndef OPENSSL_NO_ECDH
1616.   	EC_KEY *srvr_ecdh = NULL;
1617. > 	EVP_PKEY *clnt_pub_pkey = NULL;
1618.   	EC_POINT *clnt_ecpoint = NULL;
1619.   	BN_CTX *bn_ctx = NULL; 

ssl/s3_srvr.c:1618:2: 
1616.   	EC_KEY *srvr_ecdh = NULL;
1617.   	EVP_PKEY *clnt_pub_pkey = NULL;
1618. > 	EC_POINT *clnt_ecpoint = NULL;
1619.   	BN_CTX *bn_ctx = NULL; 
1620.   #endif

ssl/s3_srvr.c:1619:2: 
1617.   	EVP_PKEY *clnt_pub_pkey = NULL;
1618.   	EC_POINT *clnt_ecpoint = NULL;
1619. > 	BN_CTX *bn_ctx = NULL; 
1620.   #endif
1621.   

ssl/s3_srvr.c:1622:2: Skipping ssl3_get_message(): empty list of specs
1620.   #endif
1621.   
1622.   	n=ssl3_get_message(s,
         ^
1623.   		SSL3_ST_SR_KEY_EXCH_A,
1624.   		SSL3_ST_SR_KEY_EXCH_B,

ssl/s3_srvr.c:1629:7: Taking false branch
1627.   		&ok);
1628.   
1629.   	if (!ok) return((int)n);
              ^
1630.   	p=(unsigned char *)s->init_msg;
1631.   

ssl/s3_srvr.c:1630:2: 
1628.   
1629.   	if (!ok) return((int)n);
1630. > 	p=(unsigned char *)s->init_msg;
1631.   
1632.   	l=s->s3->tmp.new_cipher->algorithms;

ssl/s3_srvr.c:1632:2: 
1630.   	p=(unsigned char *)s->init_msg;
1631.   
1632. > 	l=s->s3->tmp.new_cipher->algorithms;
1633.   
1634.   #ifndef OPENSSL_NO_RSA

ssl/s3_srvr.c:1635:6: Taking true branch
1633.   
1634.   #ifndef OPENSSL_NO_RSA
1635.   	if (l & SSL_kRSA)
             ^
1636.   		{
1637.   		/* FIX THIS UP EAY EAY EAY EAY */

ssl/s3_srvr.c:1638:7: Taking false branch
1636.   		{
1637.   		/* FIX THIS UP EAY EAY EAY EAY */
1638.   		if (s->s3->tmp.use_rsa_tmp)
              ^
1639.   			{
1640.   			if ((s->cert != NULL) && (s->cert->rsa_tmp != NULL))

ssl/s3_srvr.c:1654:4: 
1652.   		else
1653.   			{
1654. > 			pkey=s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey;
1655.   			if (	(pkey == NULL) ||
1656.   				(pkey->type != EVP_PKEY_RSA) ||

ssl/s3_srvr.c:1655:10: Taking false branch
1653.   			{
1654.   			pkey=s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey;
1655.   			if (	(pkey == NULL) ||
                 ^
1656.   				(pkey->type != EVP_PKEY_RSA) ||
1657.   				(pkey->pkey.rsa == NULL))

ssl/s3_srvr.c:1656:6: Taking false branch
1654.   			pkey=s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey;
1655.   			if (	(pkey == NULL) ||
1656.   				(pkey->type != EVP_PKEY_RSA) ||
             ^
1657.   				(pkey->pkey.rsa == NULL))
1658.   				{

ssl/s3_srvr.c:1657:6: Taking false branch
1655.   			if (	(pkey == NULL) ||
1656.   				(pkey->type != EVP_PKEY_RSA) ||
1657.   				(pkey->pkey.rsa == NULL))
             ^
1658.   				{
1659.   				al=SSL_AD_HANDSHAKE_FAILURE;

ssl/s3_srvr.c:1663:4: 
1661.   				goto f_err;
1662.   				}
1663. > 			rsa=pkey->pkey.rsa;
1664.   			}
1665.   

ssl/s3_srvr.c:1667:7: Taking true branch
1665.   
1666.   		/* TLS */
1667.   		if (s->version > SSL3_VERSION)
              ^
1668.   			{
1669.   			n2s(p,i);

ssl/s3_srvr.c:1669:4: 
1667.   		if (s->version > SSL3_VERSION)
1668.   			{
1669. > 			n2s(p,i);
1670.   			if (n != i+2)
1671.   				{

ssl/s3_srvr.c:1670:8: Taking true branch
1668.   			{
1669.   			n2s(p,i);
1670.   			if (n != i+2)
               ^
1671.   				{
1672.   				if (!(s->options & SSL_OP_TLS_D5_BUG))

ssl/s3_srvr.c:1672:11: Taking true branch
1670.   			if (n != i+2)
1671.   				{
1672.   				if (!(s->options & SSL_OP_TLS_D5_BUG))
                  ^
1673.   					{
1674.   					SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG);

ssl/s3_srvr.c:1674:6: 
1672.   				if (!(s->options & SSL_OP_TLS_D5_BUG))
1673.   					{
1674. > 					SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG);
1675.   					goto err;
1676.   					}

crypto/err/err.c:630:1: start of procedure ERR_put_error()
  628.   /********************************************************/
  629.   
  630. > void ERR_put_error(int lib, int func, int reason, const char *file,
  631.   	     int line)
  632.   	{

crypto/err/err.c:654:2: Skipping ERR_get_state(): empty list of specs
  652.   	}
  653.   #endif
  654.   	es=ERR_get_state();
          ^
  655.   
  656.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:656:2: 
  654.   	es=ERR_get_state();
  655.   
  656. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
  657.   	if (es->top == es->bottom)
  658.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:657:6: Taking false branch
  655.   
  656.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
  657.   	if (es->top == es->bottom)
              ^
  658.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
  659.   	es->err_flags[es->top]=0;

crypto/err/err.c:659:2: 
  657.   	if (es->top == es->bottom)
  658.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
  659. > 	es->err_flags[es->top]=0;
  660.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
  661.   	es->err_file[es->top]=file;

crypto/err/err.c:660:2: 
  658.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
  659.   	es->err_flags[es->top]=0;
  660. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
  661.   	es->err_file[es->top]=file;
  662.   	es->err_line[es->top]=line;

crypto/err/err.c:661:2: 
  659.   	es->err_flags[es->top]=0;
  660.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
  661. > 	es->err_file[es->top]=file;
  662.   	es->err_line[es->top]=line;
  663.   	err_clear_data(es,es->top);

crypto/err/err.c:662:2: 
  660.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
  661.   	es->err_file[es->top]=file;
  662. > 	es->err_line[es->top]=line;
  663.   	err_clear_data(es,es->top);
  664.   	}

crypto/err/err.c:663:2: Taking true branch
  661.   	es->err_file[es->top]=file;
  662.   	es->err_line[es->top]=line;
  663.   	err_clear_data(es,es->top);
          ^
  664.   	}
  665.   

crypto/err/err.c:663:2: Taking false branch
  661.   	es->err_file[es->top]=file;
  662.   	es->err_line[es->top]=line;
  663.   	err_clear_data(es,es->top);
          ^
  664.   	}
  665.   

crypto/err/err.c:663:2: Loop condition is false. Leaving loop
  661.   	es->err_file[es->top]=file;
  662.   	es->err_line[es->top]=line;
  663.   	err_clear_data(es,es->top);
          ^
  664.   	}
  665.   

crypto/err/err.c:664:2: return from a call to ERR_put_error
  662.   	es->err_line[es->top]=line;
  663.   	err_clear_data(es,es->top);
  664.   	}
          ^
  665.   
  666.   void ERR_clear_error(void)

ssl/s3_srvr.c:2118:1: 
2116.   	ssl3_send_alert(s,SSL3_AL_FATAL,al);
2117.   #if !defined(OPENSSL_NO_DH) || !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_ECDH)
2118. > err:
2119.   #endif
2120.   #ifndef OPENSSL_NO_ECDH

ssl/s3_srvr.c:2121:2: 
2119.   #endif
2120.   #ifndef OPENSSL_NO_ECDH
2121. > 	EVP_PKEY_free(clnt_pub_pkey);
2122.   	EC_POINT_free(clnt_ecpoint);
2123.   	if (srvr_ecdh != NULL) 
