crypto/x509/x509_vfy.c:414: error: NULL_DEREFERENCE
  pointer `x` last assigned on line 412 could be null and is dereferenced at line 414, column 17.
Showing all 22 steps of the trace


crypto/x509/x509_vfy.c:372:1: start of procedure check_chain_extensions()
370.    */
371.   
372. > static int check_chain_extensions(X509_STORE_CTX *ctx)
373.   {
374.       int i, ok = 0, must_be_ca, plen = 0;

crypto/x509/x509_vfy.c:374:5: 
372.   static int check_chain_extensions(X509_STORE_CTX *ctx)
373.   {
374. >     int i, ok = 0, must_be_ca, plen = 0;
375.       X509 *x;
376.       int (*cb) (int xok, X509_STORE_CTX *xctx);

crypto/x509/x509_vfy.c:377:5: 
375.       X509 *x;
376.       int (*cb) (int xok, X509_STORE_CTX *xctx);
377. >     int proxy_path_length = 0;
378.       int purpose;
379.       int allow_proxy_certs;

crypto/x509/x509_vfy.c:380:5: 
378.       int purpose;
379.       int allow_proxy_certs;
380. >     cb = ctx->verify_cb;
381.   
382.       /*-

crypto/x509/x509_vfy.c:391:5: 
389.        *     all certificates in the chain except the leaf certificate.
390.        */
391. >     must_be_ca = -1;
392.   
393.       /* CRL path validation */

crypto/x509/x509_vfy.c:394:9: Taking false branch
392.   
393.       /* CRL path validation */
394.       if (ctx->parent) {
               ^
395.           allow_proxy_certs = 0;
396.           purpose = X509_PURPOSE_CRL_SIGN;

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

crypto/x509/x509_vfy.c:399:13: 
397.       } else {
398.           allow_proxy_certs =
399. >             ! !(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
400.           /*
401.            * A hack to keep people who don't want to modify their software

crypto/x509/x509_vfy.c:398:9: 
396.           purpose = X509_PURPOSE_CRL_SIGN;
397.       } else {
398. >         allow_proxy_certs =
399.               ! !(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
400.           /*

crypto/x509/x509_vfy.c:404:13: Taking false branch
402.            * happy
403.            */
404.           if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
                   ^
405.               allow_proxy_certs = 1;
406.           purpose = ctx->param->purpose;

crypto/x509/x509_vfy.c:406:9: 
404.           if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
405.               allow_proxy_certs = 1;
406. >         purpose = ctx->param->purpose;
407.       }
408.   

crypto/x509/x509_vfy.c:410:10: 
408.   
409.       /* Check all untrusted certificates */
410. >     for (i = 0; i == 0 || i < ctx->num_untrusted; i++) {
411.           int ret;
412.           x = sk_X509_value(ctx->chain, i);

crypto/x509/x509_vfy.c:410:17: Loop condition is true. Entering loop body
408.   
409.       /* Check all untrusted certificates */
410.       for (i = 0; i == 0 || i < ctx->num_untrusted; i++) {
                       ^
411.           int ret;
412.           x = sk_X509_value(ctx->chain, i);

crypto/x509/x509_vfy.c:412:9: 
410.       for (i = 0; i == 0 || i < ctx->num_untrusted; i++) {
411.           int ret;
412. >         x = sk_X509_value(ctx->chain, i);
413.           if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
414.               && (x->ex_flags & EXFLAG_CRITICAL)) {

include/openssl/x509.h:170:1: start of procedure sk_X509_value()
  168.   typedef struct x509_cinf_st X509_CINF;
  169.   
  170. > DEFINE_STACK_OF(X509)
  171.   
  172.   /* This is used for a table of trust checking functions */

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

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

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

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

include/openssl/x509.h:170:1: return from a call to sk_X509_value
  168.   typedef struct x509_cinf_st X509_CINF;
  169.   
  170. > DEFINE_STACK_OF(X509)
  171.   
  172.   /* This is used for a table of trust checking functions */

crypto/x509/x509_vfy.c:413:15: Taking true branch
411.           int ret;
412.           x = sk_X509_value(ctx->chain, i);
413.           if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
                     ^
414.               && (x->ex_flags & EXFLAG_CRITICAL)) {
415.               ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION;

crypto/x509/x509_vfy.c:414:17: 
412.           x = sk_X509_value(ctx->chain, i);
413.           if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
414. >             && (x->ex_flags & EXFLAG_CRITICAL)) {
415.               ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION;
416.               ctx->error_depth = i;
