crypto/x509/x509_vfy.c:591: error: NULL_DEREFERENCE
  pointer `x` last assigned on line 581 could be null and is dereferenced at line 591, column 30.
Showing all 24 steps of the trace


crypto/x509/x509_vfy.c:537:1: start of procedure check_chain_extensions()
535.    */
536.   
537. > static int check_chain_extensions(X509_STORE_CTX *ctx)
538.   {
539.   #ifdef OPENSSL_NO_CHAIN_VERIFY

crypto/x509/x509_vfy.c:542:2: 
540.   	return 1;
541.   #else
542. > 	int i, ok=0, must_be_ca, plen = 0;
543.   	X509 *x;
544.   	int (*cb)(int xok,X509_STORE_CTX *xctx);

crypto/x509/x509_vfy.c:545:2: 
543.   	X509 *x;
544.   	int (*cb)(int xok,X509_STORE_CTX *xctx);
545. > 	int proxy_path_length = 0;
546.   	int purpose;
547.   	int allow_proxy_certs;

crypto/x509/x509_vfy.c:548:2: 
546.   	int purpose;
547.   	int allow_proxy_certs;
548. > 	cb=ctx->verify_cb;
549.   
550.   	/* must_be_ca can have 1 of 3 values:

crypto/x509/x509_vfy.c:558:2: 
556.   	       all certificates in the chain except the leaf certificate.
557.   	*/
558. > 	must_be_ca = -1;
559.   
560.   	/* CRL path validation */

crypto/x509/x509_vfy.c:561:6: Taking false branch
559.   
560.   	/* CRL path validation */
561.   	if (ctx->parent)
            ^
562.   		{
563.   		allow_proxy_certs = 0;

crypto/x509/x509_vfy.c:569:7: Condition is true
567.   		{
568.   		allow_proxy_certs =
569.   			!!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
             ^
570.   		/* A hack to keep people who don't want to modify their
571.   		   software happy */

crypto/x509/x509_vfy.c:569:4: 
567.   		{
568.   		allow_proxy_certs =
569. > 			!!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
570.   		/* A hack to keep people who don't want to modify their
571.   		   software happy */

crypto/x509/x509_vfy.c:568:3: 
566.   	else
567.   		{
568. > 		allow_proxy_certs =
569.   			!!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
570.   		/* A hack to keep people who don't want to modify their

crypto/x509/x509_vfy.c:572:7: Taking false branch
570.   		/* A hack to keep people who don't want to modify their
571.   		   software happy */
572.   		if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
             ^
573.   			allow_proxy_certs = 1;
574.   		purpose = ctx->param->purpose;

crypto/x509/x509_vfy.c:574:3: 
572.   		if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
573.   			allow_proxy_certs = 1;
574. > 		purpose = ctx->param->purpose;
575.   		}
576.   

crypto/x509/x509_vfy.c:578:7: 
576.   
577.   	/* Check all untrusted certificates */
578. > 	for (i = 0; i < ctx->last_untrusted; i++)
579.   		{
580.   		int ret;

crypto/x509/x509_vfy.c:578:14: Loop condition is true. Entering loop body
576.   
577.   	/* Check all untrusted certificates */
578.   	for (i = 0; i < ctx->last_untrusted; i++)
                    ^
579.   		{
580.   		int ret;

crypto/x509/x509_vfy.c:581:7: Condition is true
579.   		{
580.   		int ret;
581.   		x = sk_X509_value(ctx->chain, i);
             ^
582.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
583.   			&& (x->ex_flags & EXFLAG_CRITICAL))

crypto/x509/x509_vfy.c:581:3: 
579.   		{
580.   		int ret;
581. > 		x = sk_X509_value(ctx->chain, i);
582.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
583.   			&& (x->ex_flags & EXFLAG_CRITICAL))

crypto/stack/stack.c:300:1: start of procedure sk_value()
  298.   }
  299.   
  300. > void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:302:6: Taking false branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:13: Taking false branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:24: Taking true branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                                ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:39: 
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:304:1: return from a call to sk_value
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  303.   	return st->data[i];
  304. > }
  305.   
  306.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:582:9: Taking false branch
580.   		int ret;
581.   		x = sk_X509_value(ctx->chain, i);
582.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
               ^
583.   			&& (x->ex_flags & EXFLAG_CRITICAL))
584.   			{

crypto/x509/x509_vfy.c:591:8: Taking true branch
589.   			if (!ok) goto end;
590.   			}
591.   		if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY))
              ^
592.   			{
593.   			ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED;

crypto/x509/x509_vfy.c:591:30: 
589.   			if (!ok) goto end;
590.   			}
591. > 		if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY))
592.   			{
593.   			ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED;
