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


crypto/x509/x509_vfy.c:449:1: start of procedure check_chain_extensions()
447.    */
448.   
449. > static int check_chain_extensions(X509_STORE_CTX *ctx)
450.   {
451.   #ifdef OPENSSL_NO_CHAIN_VERIFY

crypto/x509/x509_vfy.c:454:2: 
452.   	return 1;
453.   #else
454. > 	int i, ok=0, must_be_ca, plen = 0;
455.   	X509 *x;
456.   	int (*cb)(int xok,X509_STORE_CTX *xctx);

crypto/x509/x509_vfy.c:457:2: 
455.   	X509 *x;
456.   	int (*cb)(int xok,X509_STORE_CTX *xctx);
457. > 	int proxy_path_length = 0;
458.   	int purpose;
459.   	int allow_proxy_certs;

crypto/x509/x509_vfy.c:460:2: 
458.   	int purpose;
459.   	int allow_proxy_certs;
460. > 	cb=ctx->verify_cb;
461.   
462.   	/* must_be_ca can have 1 of 3 values:

crypto/x509/x509_vfy.c:470:2: 
468.   	       all certificates in the chain except the leaf certificate.
469.   	*/
470. > 	must_be_ca = -1;
471.   
472.   	/* CRL path validation */

crypto/x509/x509_vfy.c:473:6: Taking false branch
471.   
472.   	/* CRL path validation */
473.   	if (ctx->parent)
            ^
474.   		{
475.   		allow_proxy_certs = 0;

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

crypto/x509/x509_vfy.c:481:4: 
479.   		{
480.   		allow_proxy_certs =
481. > 			!!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
482.   		/* A hack to keep people who don't want to modify their
483.   		   software happy */

crypto/x509/x509_vfy.c:480:3: 
478.   	else
479.   		{
480. > 		allow_proxy_certs =
481.   			!!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
482.   		/* A hack to keep people who don't want to modify their

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

crypto/x509/x509_vfy.c:486:3: 
484.   		if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
485.   			allow_proxy_certs = 1;
486. > 		purpose = ctx->param->purpose;
487.   		}
488.   

crypto/x509/x509_vfy.c:490:7: 
488.   
489.   	/* Check all untrusted certificates */
490. > 	for (i = 0; i < ctx->last_untrusted; i++)
491.   		{
492.   		int ret;

crypto/x509/x509_vfy.c:490:14: Loop condition is true. Entering loop body
488.   
489.   	/* Check all untrusted certificates */
490.   	for (i = 0; i < ctx->last_untrusted; i++)
                    ^
491.   		{
492.   		int ret;

crypto/x509/x509_vfy.c:493:7: Condition is true
491.   		{
492.   		int ret;
493.   		x = sk_X509_value(ctx->chain, i);
             ^
494.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
495.   			&& (x->ex_flags & EXFLAG_CRITICAL))

crypto/x509/x509_vfy.c:493:3: 
491.   		{
492.   		int ret;
493. > 		x = sk_X509_value(ctx->chain, i);
494.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
495.   			&& (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:494:9: Taking false branch
492.   		int ret;
493.   		x = sk_X509_value(ctx->chain, i);
494.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
               ^
495.   			&& (x->ex_flags & EXFLAG_CRITICAL))
496.   			{

crypto/x509/x509_vfy.c:503:8: Taking true branch
501.   			if (!ok) goto end;
502.   			}
503.   		if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY))
              ^
504.   			{
505.   			ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED;

crypto/x509/x509_vfy.c:503:30: 
501.   			if (!ok) goto end;
502.   			}
503. > 		if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY))
504.   			{
505.   			ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED;
