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


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

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

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

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

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

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

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

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

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

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

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

apps/s_server.c:633:9: 
631.   
632.       if (srctx->verbose)
633. >         BIO_puts(bio_err, "cert_status: callback called\n");
634.       /* Build up OCSP query from server certificate */
635.       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:635:5: 
633.           BIO_puts(bio_err, "cert_status: callback called\n");
634.       /* Build up OCSP query from server certificate */
635. >     x = SSL_get_certificate(s);
636.       aia = X509_get1_ocsp(x);
637.       if (aia) {

ssl/ssl_lib.c:2665:1: start of procedure SSL_get_certificate()
  2663.   }
  2664.   
  2665. > X509 *SSL_get_certificate(const SSL *s)
  2666.   {
  2667.       if (s->cert != NULL)

ssl/ssl_lib.c:2667:9: Taking false branch
  2665.   X509 *SSL_get_certificate(const SSL *s)
  2666.   {
  2667.       if (s->cert != NULL)
                  ^
  2668.           return (s->cert->key->x509);
  2669.       else

ssl/ssl_lib.c:2670:9: 
  2668.           return (s->cert->key->x509);
  2669.       else
  2670. >         return (NULL);
  2671.   }
  2672.   

ssl/ssl_lib.c:2671:1: return from a call to SSL_get_certificate
  2669.       else
  2670.           return (NULL);
  2671. > }
  2672.   
  2673.   EVP_PKEY *SSL_get_privatekey(const SSL *s)

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