apps/s_server.c:638: error: NULL_DEREFERENCE
  pointer `x` last assigned on line 637 could be null and is dereferenced by call to `X509_get1_ocsp()` at line 638, column 11.
Showing all 36 steps of the trace


apps/s_server.c:616:1: start of procedure cert_status_cb()
614.    */
615.   
616. > static int cert_status_cb(SSL *s, void *arg)
617.   {
618.       tlsextstatusctx *srctx = arg;

apps/s_server.c:618:5: 
616.   static int cert_status_cb(SSL *s, void *arg)
617.   {
618. >     tlsextstatusctx *srctx = arg;
619.       char *host = NULL, *port = NULL, *path = NULL;
620.       int use_ssl;

apps/s_server.c:619:5: 
617.   {
618.       tlsextstatusctx *srctx = arg;
619. >     char *host = NULL, *port = NULL, *path = NULL;
620.       int use_ssl;
621.       unsigned char *rspder = NULL;

apps/s_server.c:621:5: 
619.       char *host = NULL, *port = NULL, *path = NULL;
620.       int use_ssl;
621. >     unsigned char *rspder = NULL;
622.       int rspderlen;
623.       STACK_OF(OPENSSL_STRING) *aia = NULL;

apps/s_server.c:623:5: 
621.       unsigned char *rspder = NULL;
622.       int rspderlen;
623. >     STACK_OF(OPENSSL_STRING) *aia = NULL;
624.       X509 *x = NULL;
625.       X509_STORE_CTX inctx;

apps/s_server.c:624:5: 
622.       int rspderlen;
623.       STACK_OF(OPENSSL_STRING) *aia = NULL;
624. >     X509 *x = NULL;
625.       X509_STORE_CTX inctx;
626.       X509_OBJECT obj;

apps/s_server.c:627:5: 
625.       X509_STORE_CTX inctx;
626.       X509_OBJECT obj;
627. >     OCSP_REQUEST *req = NULL;
628.       OCSP_RESPONSE *resp = NULL;
629.       OCSP_CERTID *id = NULL;

apps/s_server.c:628:5: 
626.       X509_OBJECT obj;
627.       OCSP_REQUEST *req = NULL;
628. >     OCSP_RESPONSE *resp = NULL;
629.       OCSP_CERTID *id = NULL;
630.       STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:629:5: 
627.       OCSP_REQUEST *req = NULL;
628.       OCSP_RESPONSE *resp = NULL;
629. >     OCSP_CERTID *id = NULL;
630.       STACK_OF(X509_EXTENSION) *exts;
631.       int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:631:5: 
629.       OCSP_CERTID *id = NULL;
630.       STACK_OF(X509_EXTENSION) *exts;
631. >     int ret = SSL_TLSEXT_ERR_NOACK;
632.       int i;
633.   

apps/s_server.c:634:9: Taking true branch
632.       int i;
633.   
634.       if (srctx->verbose)
               ^
635.           BIO_puts(bio_err, "cert_status: callback called\n");
636.       /* Build up OCSP query from server certificate */

apps/s_server.c:635:9: 
633.   
634.       if (srctx->verbose)
635. >         BIO_puts(bio_err, "cert_status: callback called\n");
636.       /* Build up OCSP query from server certificate */
637.       x = SSL_get_certificate(s);

crypto/bio/bio_lib.c:252:1: start of procedure BIO_puts()
  250.   }
  251.   
  252. > int BIO_puts(BIO *b, const char *in)
  253.   {
  254.       int i;

crypto/bio/bio_lib.c:257:10: Taking false branch
  255.       long (*cb) (BIO *, int, const char *, int, long, long);
  256.   
  257.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                  ^
  258.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  259.           return (-2);

crypto/bio/bio_lib.c:257:25: Taking false branch
  255.       long (*cb) (BIO *, int, const char *, int, long, long);
  256.   
  257.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                                 ^
  258.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  259.           return (-2);

crypto/bio/bio_lib.c:257:48: Taking false branch
  255.       long (*cb) (BIO *, int, const char *, int, long, long);
  256.   
  257.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                                                        ^
  258.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  259.           return (-2);

crypto/bio/bio_lib.c:262:5: 
  260.       }
  261.   
  262. >     cb = b->callback;
  263.   
  264.       if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0))

crypto/bio/bio_lib.c:264:10: Taking false branch
  262.       cb = b->callback;
  263.   
  264.       if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0))
                  ^
  265.           return (i);
  266.   

crypto/bio/bio_lib.c:267:10: Taking false branch
  265.           return (i);
  266.   
  267.       if (!b->init) {
                  ^
  268.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
  269.           return (-2);

crypto/bio/bio_lib.c:272:5: Skipping __function_pointer__(): unresolved function pointer
  270.       }
  271.   
  272.       i = b->method->bputs(b, in);
             ^
  273.   
  274.       if (i > 0)

crypto/bio/bio_lib.c:274:9: Taking true branch
  272.       i = b->method->bputs(b, in);
  273.   
  274.       if (i > 0)
                 ^
  275.           b->num_write += (uint64_t)i;
  276.   

crypto/bio/bio_lib.c:275:9: 
  273.   
  274.       if (i > 0)
  275. >         b->num_write += (uint64_t)i;
  276.   
  277.       if (cb != NULL)

crypto/bio/bio_lib.c:277:9: Taking false branch
  275.           b->num_write += (uint64_t)i;
  276.   
  277.       if (cb != NULL)
                 ^
  278.           i = (int)cb(b, BIO_CB_PUTS | BIO_CB_RETURN, in, 0, 0L, (long)i);
  279.       return (i);

crypto/bio/bio_lib.c:279:5: 
  277.       if (cb != NULL)
  278.           i = (int)cb(b, BIO_CB_PUTS | BIO_CB_RETURN, in, 0, 0L, (long)i);
  279. >     return (i);
  280.   }
  281.   

crypto/bio/bio_lib.c:280:1: return from a call to BIO_puts
  278.           i = (int)cb(b, BIO_CB_PUTS | BIO_CB_RETURN, in, 0, 0L, (long)i);
  279.       return (i);
  280. > }
  281.   
  282.   int BIO_gets(BIO *b, char *in, int inl)

apps/s_server.c:637:5: 
635.           BIO_puts(bio_err, "cert_status: callback called\n");
636.       /* Build up OCSP query from server certificate */
637. >     x = SSL_get_certificate(s);
638.       aia = X509_get1_ocsp(x);
639.       if (aia) {

ssl/ssl_lib.c:3149:1: start of procedure SSL_get_certificate()
  3147.   }
  3148.   
  3149. > X509 *SSL_get_certificate(const SSL *s)
  3150.   {
  3151.       if (s->cert != NULL)

ssl/ssl_lib.c:3151:9: Taking false branch
  3149.   X509 *SSL_get_certificate(const SSL *s)
  3150.   {
  3151.       if (s->cert != NULL)
                  ^
  3152.           return (s->cert->key->x509);
  3153.       else

ssl/ssl_lib.c:3154:9: 
  3152.           return (s->cert->key->x509);
  3153.       else
  3154. >         return (NULL);
  3155.   }
  3156.   

ssl/ssl_lib.c:3155:1: return from a call to SSL_get_certificate
  3153.       else
  3154.           return (NULL);
  3155. > }
  3156.   
  3157.   EVP_PKEY *SSL_get_privatekey(const SSL *s)

apps/s_server.c:638:5: 
636.       /* Build up OCSP query from server certificate */
637.       x = SSL_get_certificate(s);
638. >     aia = X509_get1_ocsp(x);
639.       if (aia) {
640.           if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0),

crypto/x509v3/v3_utl.c:535:1: start of procedure X509_get1_ocsp()
  533.   }
  534.   
  535. > STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x)
  536.   {
  537.       AUTHORITY_INFO_ACCESS *info;

crypto/x509v3/v3_utl.c:538:5: 
  536.   {
  537.       AUTHORITY_INFO_ACCESS *info;
  538. >     STACK_OF(OPENSSL_STRING) *ret = NULL;
  539.       int i;
  540.   

crypto/x509v3/v3_utl.c:541:5: 
  539.       int i;
  540.   
  541. >     info = X509_get_ext_d2i(x, NID_info_access, NULL, NULL);
  542.       if (!info)
  543.           return NULL;

crypto/x509/x509_ext.c:151:1: start of procedure X509_get_ext_d2i()
    149.   }
    150.   
    151. > void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx)
    152.   {
    153.       return X509V3_get_d2i(x->cert_info.extensions, nid, crit, idx);

crypto/x509/x509_ext.c:153:5: 
    151.   void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx)
    152.   {
    153. >     return X509V3_get_d2i(x->cert_info.extensions, nid, crit, idx);
    154.   }
    155.   
