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


apps/s_server.c:700:1: start of procedure cert_status_cb()
698.    */
699.   
700. > static int cert_status_cb(SSL *s, void *arg)
701.   	{
702.   	tlsextstatusctx *srctx = arg;

apps/s_server.c:702:2: 
700.   static int cert_status_cb(SSL *s, void *arg)
701.   	{
702. > 	tlsextstatusctx *srctx = arg;
703.   	BIO *err = srctx->err;
704.   	char *host, *port, *path;

apps/s_server.c:703:2: 
701.   	{
702.   	tlsextstatusctx *srctx = arg;
703. > 	BIO *err = srctx->err;
704.   	char *host, *port, *path;
705.   	int use_ssl;

apps/s_server.c:706:2: 
704.   	char *host, *port, *path;
705.   	int use_ssl;
706. > 	unsigned char *rspder = NULL;
707.   	int rspderlen;
708.   	STACK_OF(STRING) *aia = NULL;

apps/s_server.c:708:2: 
706.   	unsigned char *rspder = NULL;
707.   	int rspderlen;
708. > 	STACK_OF(STRING) *aia = NULL;
709.   	X509 *x = NULL;
710.   	X509_STORE_CTX inctx;

apps/s_server.c:709:2: 
707.   	int rspderlen;
708.   	STACK_OF(STRING) *aia = NULL;
709. > 	X509 *x = NULL;
710.   	X509_STORE_CTX inctx;
711.   	X509_OBJECT obj;

apps/s_server.c:712:2: 
710.   	X509_STORE_CTX inctx;
711.   	X509_OBJECT obj;
712. > 	OCSP_REQUEST *req = NULL;
713.   	OCSP_RESPONSE *resp = NULL;
714.   	OCSP_CERTID *id = NULL;

apps/s_server.c:713:2: 
711.   	X509_OBJECT obj;
712.   	OCSP_REQUEST *req = NULL;
713. > 	OCSP_RESPONSE *resp = NULL;
714.   	OCSP_CERTID *id = NULL;
715.   	STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:714:2: 
712.   	OCSP_REQUEST *req = NULL;
713.   	OCSP_RESPONSE *resp = NULL;
714. > 	OCSP_CERTID *id = NULL;
715.   	STACK_OF(X509_EXTENSION) *exts;
716.   	int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:716:2: 
714.   	OCSP_CERTID *id = NULL;
715.   	STACK_OF(X509_EXTENSION) *exts;
716. > 	int ret = SSL_TLSEXT_ERR_NOACK;
717.   	int i;
718.   #if 0

apps/s_server.c:723:6: Taking true branch
721.   BIO_printf(err, "cert_status: received %d ids\n", sk_OCSP_RESPID_num(ids));
722.   #endif
723.   	if (srctx->verbose)
            ^
724.   		BIO_puts(err, "cert_status: callback called\n");
725.   	/* Build up OCSP query from server certificate */

apps/s_server.c:724:3: 
722.   #endif
723.   	if (srctx->verbose)
724. > 		BIO_puts(err, "cert_status: callback called\n");
725.   	/* Build up OCSP query from server certificate */
726.   	x = SSL_get_certificate(s);

crypto/bio/bio_lib.c:259:1: start of procedure BIO_puts()
  257.   	}
  258.   
  259. > int BIO_puts(BIO *b, const char *in)
  260.   	{
  261.   	int i;

crypto/bio/bio_lib.c:264:7: Taking false branch
  262.   	long (*cb)(BIO *, int, const char *, size_t, long, long);
  263.   
  264.   	if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL))
               ^
  265.   		{
  266.   		BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD);

crypto/bio/bio_lib.c:264:22: Taking false branch
  262.   	long (*cb)(BIO *, int, const char *, size_t, long, long);
  263.   
  264.   	if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL))
                              ^
  265.   		{
  266.   		BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD);

crypto/bio/bio_lib.c:264:45: Taking false branch
  262.   	long (*cb)(BIO *, int, const char *, size_t, long, long);
  263.   
  264.   	if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL))
                                                     ^
  265.   		{
  266.   		BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD);

crypto/bio/bio_lib.c:270:2: 
  268.   		}
  269.   
  270. > 	cb=b->callback;
  271.   
  272.   	if ((cb != NULL) &&

crypto/bio/bio_lib.c:272:7: Taking true branch
  270.   	cb=b->callback;
  271.   
  272.   	if ((cb != NULL) &&
               ^
  273.   		((i=(int)cb(b,BIO_CB_PUTS,in,0,0L,1L)) <= 0))
  274.   			return(i);

crypto/bio/bio_lib.c:273:4: Taking true branch
  271.   
  272.   	if ((cb != NULL) &&
  273.   		((i=(int)cb(b,BIO_CB_PUTS,in,0,0L,1L)) <= 0))
            ^
  274.   			return(i);
  275.   

crypto/bio/bio_lib.c:274:4: 
  272.   	if ((cb != NULL) &&
  273.   		((i=(int)cb(b,BIO_CB_PUTS,in,0,0L,1L)) <= 0))
  274. > 			return(i);
  275.   
  276.   	if (!b->init)

crypto/bio/bio_lib.c:290:2: return from a call to BIO_puts
  288.   			0L,(long)i);
  289.   	return(i);
  290.   	}
          ^
  291.   
  292.   int BIO_gets(BIO *b, char *in, int inl)

apps/s_server.c:726:2: 
724.   		BIO_puts(err, "cert_status: callback called\n");
725.   	/* Build up OCSP query from server certificate */
726. > 	x = SSL_get_certificate(s);
727.   	aia = X509_get1_ocsp(x);
728.   	if (aia)

ssl/ssl_lib.c:2533:1: start of procedure SSL_get_certificate()
  2531.   
  2532.   /* Fix this function so that it takes an optional type parameter */
  2533. > X509 *SSL_get_certificate(const SSL *s)
  2534.   	{
  2535.   	if (s->cert != NULL)

ssl/ssl_lib.c:2535:6: Taking false branch
  2533.   X509 *SSL_get_certificate(const SSL *s)
  2534.   	{
  2535.   	if (s->cert != NULL)
               ^
  2536.   		return(s->cert->key->x509);
  2537.   	else

ssl/ssl_lib.c:2538:3: 
  2536.   		return(s->cert->key->x509);
  2537.   	else
  2538. > 		return(NULL);
  2539.   	}
  2540.   

ssl/ssl_lib.c:2539:2: return from a call to SSL_get_certificate
  2537.   	else
  2538.   		return(NULL);
  2539.   	}
           ^
  2540.   
  2541.   /* Fix this function so that it takes an optional type parameter */

apps/s_server.c:727:2: 
725.   	/* Build up OCSP query from server certificate */
726.   	x = SSL_get_certificate(s);
727. > 	aia = X509_get1_ocsp(x);
728.   	if (aia)
729.   		{
