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


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

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

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

crypto/x509/x509_vfy.c:550:5: 
548.       int purpose;
549.       int allow_proxy_certs;
550. >     cb = ctx->verify_cb;
551.   
552.       /*-

crypto/x509/x509_vfy.c:561:5: 
559.        *     all certificates in the chain except the leaf certificate.
560.        */
561. >     must_be_ca = -1;
562.   
563.       /* CRL path validation */

crypto/x509/x509_vfy.c:564:9: Taking false branch
562.   
563.       /* CRL path validation */
564.       if (ctx->parent) {
               ^
565.           allow_proxy_certs = 0;
566.           purpose = X509_PURPOSE_CRL_SIGN;

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

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

crypto/x509/x509_vfy.c:568:9: 
566.           purpose = X509_PURPOSE_CRL_SIGN;
567.       } else {
568. >         allow_proxy_certs =
569.               ! !(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
570.           /*

crypto/x509/x509_vfy.c:574:13: Taking false branch
572.            * happy
573.            */
574.           if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
                   ^
575.               allow_proxy_certs = 1;
576.           purpose = ctx->param->purpose;

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

crypto/x509/x509_vfy.c:580:10: 
578.   
579.       /* Check all untrusted certificates */
580. >     for (i = 0; i < ctx->last_untrusted; i++) {
581.           int ret;
582.           x = sk_X509_value(ctx->chain, i);

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

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

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

crypto/stack/stack.c:347:1: start of procedure sk_value()
  345.   }
  346.   
  347. > void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:349:10: Taking false branch
  347.   void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
                  ^
  350.           return NULL;
  351.       return st->data[i];

crypto/stack/stack.c:349:17: Taking false branch
  347.   void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
                         ^
  350.           return NULL;
  351.       return st->data[i];

crypto/stack/stack.c:349:28: Taking true branch
  347.   void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  350.           return NULL;
  351.       return st->data[i];

crypto/stack/stack.c:350:9: 
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
  350. >         return NULL;
  351.       return st->data[i];
  352.   }

crypto/stack/stack.c:352:1: return from a call to sk_value
  350.           return NULL;
  351.       return st->data[i];
  352. > }
  353.   
  354.   void *sk_set(_STACK *st, int i, void *value)

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

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

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