crypto/x509/x509_vfy.c:587: error: NULL_DEREFERENCE
  pointer `x` last assigned on line 577 could be null and is dereferenced at line 587, column 36.
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.       int i, ok = 0, must_be_ca, plen = 0;

crypto/x509/x509_vfy.c:539:5: 
537.   static int check_chain_extensions(X509_STORE_CTX *ctx)
538.   {
539. >     int i, ok = 0, must_be_ca, plen = 0;
540.       X509 *x;
541.       int (*cb) (int xok, X509_STORE_CTX *xctx);

crypto/x509/x509_vfy.c:542:5: 
540.       X509 *x;
541.       int (*cb) (int xok, X509_STORE_CTX *xctx);
542. >     int proxy_path_length = 0;
543.       int purpose;
544.       int allow_proxy_certs;

crypto/x509/x509_vfy.c:545:5: 
543.       int purpose;
544.       int allow_proxy_certs;
545. >     cb = ctx->verify_cb;
546.   
547.       /*-

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

crypto/x509/x509_vfy.c:559:9: Taking false branch
557.   
558.       /* CRL path validation */
559.       if (ctx->parent) {
               ^
560.           allow_proxy_certs = 0;
561.           purpose = X509_PURPOSE_CRL_SIGN;

crypto/x509/x509_vfy.c:564:17: Condition is true
562.       } else {
563.           allow_proxy_certs =
564.               ! !(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
                       ^
565.           /*
566.            * A hack to keep people who don't want to modify their software

crypto/x509/x509_vfy.c:564:13: 
562.       } else {
563.           allow_proxy_certs =
564. >             ! !(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
565.           /*
566.            * A hack to keep people who don't want to modify their software

crypto/x509/x509_vfy.c:563:9: 
561.           purpose = X509_PURPOSE_CRL_SIGN;
562.       } else {
563. >         allow_proxy_certs =
564.               ! !(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
565.           /*

crypto/x509/x509_vfy.c:569:13: Taking false branch
567.            * happy
568.            */
569.           if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
                   ^
570.               allow_proxy_certs = 1;
571.           purpose = ctx->param->purpose;

crypto/x509/x509_vfy.c:571:9: 
569.           if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
570.               allow_proxy_certs = 1;
571. >         purpose = ctx->param->purpose;
572.       }
573.   

crypto/x509/x509_vfy.c:575:10: 
573.   
574.       /* Check all untrusted certificates */
575. >     for (i = 0; i < ctx->last_untrusted; i++) {
576.           int ret;
577.           x = sk_X509_value(ctx->chain, i);

crypto/x509/x509_vfy.c:575:17: Loop condition is true. Entering loop body
573.   
574.       /* Check all untrusted certificates */
575.       for (i = 0; i < ctx->last_untrusted; i++) {
                       ^
576.           int ret;
577.           x = sk_X509_value(ctx->chain, i);

crypto/x509/x509_vfy.c:577:13: Condition is true
575.       for (i = 0; i < ctx->last_untrusted; i++) {
576.           int ret;
577.           x = sk_X509_value(ctx->chain, i);
                   ^
578.           if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
579.               && (x->ex_flags & EXFLAG_CRITICAL)) {

crypto/x509/x509_vfy.c:577:9: 
575.       for (i = 0; i < ctx->last_untrusted; i++) {
576.           int ret;
577. >         x = sk_X509_value(ctx->chain, i);
578.           if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
579.               && (x->ex_flags & EXFLAG_CRITICAL)) {

crypto/stack/stack.c:326:1: start of procedure sk_value()
  324.   }
  325.   
  326. > void *sk_value(const _STACK *st, int i)
  327.   {
  328.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:328:10: Taking false branch
  326.   void *sk_value(const _STACK *st, int i)
  327.   {
  328.       if (!st || (i < 0) || (i >= st->num))
                  ^
  329.           return NULL;
  330.       return st->data[i];

crypto/stack/stack.c:328:17: Taking false branch
  326.   void *sk_value(const _STACK *st, int i)
  327.   {
  328.       if (!st || (i < 0) || (i >= st->num))
                         ^
  329.           return NULL;
  330.       return st->data[i];

crypto/stack/stack.c:328:28: Taking true branch
  326.   void *sk_value(const _STACK *st, int i)
  327.   {
  328.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  329.           return NULL;
  330.       return st->data[i];

crypto/stack/stack.c:329:9: 
  327.   {
  328.       if (!st || (i < 0) || (i >= st->num))
  329. >         return NULL;
  330.       return st->data[i];
  331.   }

crypto/stack/stack.c:331:1: return from a call to sk_value
  329.           return NULL;
  330.       return st->data[i];
  331. > }
  332.   
  333.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:578:15: Taking false branch
576.           int ret;
577.           x = sk_X509_value(ctx->chain, i);
578.           if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
                     ^
579.               && (x->ex_flags & EXFLAG_CRITICAL)) {
580.               ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION;

crypto/x509/x509_vfy.c:587:14: Taking true branch
585.                   goto end;
586.           }
587.           if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY)) {
                    ^
588.               ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED;
589.               ctx->error_depth = i;

crypto/x509/x509_vfy.c:587:36: 
585.                   goto end;
586.           }
587. >         if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY)) {
588.               ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED;
589.               ctx->error_depth = i;
