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


apps/s_server.c:780:1: start of procedure cert_status_cb()
778.    */
779.   
780. > static int cert_status_cb(SSL *s, void *arg)
781.   	{
782.   	tlsextstatusctx *srctx = arg;

apps/s_server.c:782:2: 
780.   static int cert_status_cb(SSL *s, void *arg)
781.   	{
782. > 	tlsextstatusctx *srctx = arg;
783.   	BIO *err = srctx->err;
784.   	char *host, *port, *path;

apps/s_server.c:783:2: 
781.   	{
782.   	tlsextstatusctx *srctx = arg;
783. > 	BIO *err = srctx->err;
784.   	char *host, *port, *path;
785.   	int use_ssl;

apps/s_server.c:786:2: 
784.   	char *host, *port, *path;
785.   	int use_ssl;
786. > 	unsigned char *rspder = NULL;
787.   	int rspderlen;
788.   	STACK_OF(OPENSSL_STRING) *aia = NULL;

apps/s_server.c:788:2: 
786.   	unsigned char *rspder = NULL;
787.   	int rspderlen;
788. > 	STACK_OF(OPENSSL_STRING) *aia = NULL;
789.   	X509 *x = NULL;
790.   	X509_STORE_CTX inctx;

apps/s_server.c:789:2: 
787.   	int rspderlen;
788.   	STACK_OF(OPENSSL_STRING) *aia = NULL;
789. > 	X509 *x = NULL;
790.   	X509_STORE_CTX inctx;
791.   	X509_OBJECT obj;

apps/s_server.c:792:2: 
790.   	X509_STORE_CTX inctx;
791.   	X509_OBJECT obj;
792. > 	OCSP_REQUEST *req = NULL;
793.   	OCSP_RESPONSE *resp = NULL;
794.   	OCSP_CERTID *id = NULL;

apps/s_server.c:793:2: 
791.   	X509_OBJECT obj;
792.   	OCSP_REQUEST *req = NULL;
793. > 	OCSP_RESPONSE *resp = NULL;
794.   	OCSP_CERTID *id = NULL;
795.   	STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:794:2: 
792.   	OCSP_REQUEST *req = NULL;
793.   	OCSP_RESPONSE *resp = NULL;
794. > 	OCSP_CERTID *id = NULL;
795.   	STACK_OF(X509_EXTENSION) *exts;
796.   	int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:796:2: 
794.   	OCSP_CERTID *id = NULL;
795.   	STACK_OF(X509_EXTENSION) *exts;
796. > 	int ret = SSL_TLSEXT_ERR_NOACK;
797.   	int i;
798.   #if 0

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

apps/s_server.c:804:3: 
802.   #endif
803.   	if (srctx->verbose)
804. > 		BIO_puts(err, "cert_status: callback called\n");
805.   	/* Build up OCSP query from server certificate */
806.   	x = SSL_get_certificate(s);

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

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

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

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

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

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

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

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

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

apps/s_server.c:806:2: 
804.   		BIO_puts(err, "cert_status: callback called\n");
805.   	/* Build up OCSP query from server certificate */
806. > 	x = SSL_get_certificate(s);
807.   	aia = X509_get1_ocsp(x);
808.   	if (aia)

ssl/ssl_lib.c:2781:1: start of procedure SSL_get_certificate()
  2779.   
  2780.   /* Fix this function so that it takes an optional type parameter */
  2781. > X509 *SSL_get_certificate(const SSL *s)
  2782.   	{
  2783.   	if (s->cert != NULL)

ssl/ssl_lib.c:2783:6: Taking false branch
  2781.   X509 *SSL_get_certificate(const SSL *s)
  2782.   	{
  2783.   	if (s->cert != NULL)
               ^
  2784.   		return(s->cert->key->x509);
  2785.   	else

ssl/ssl_lib.c:2786:3: 
  2784.   		return(s->cert->key->x509);
  2785.   	else
  2786. > 		return(NULL);
  2787.   	}
  2788.   

ssl/ssl_lib.c:2787:2: return from a call to SSL_get_certificate
  2785.   	else
  2786.   		return(NULL);
  2787.   	}
           ^
  2788.   
  2789.   /* Fix this function so that it takes an optional type parameter */

apps/s_server.c:807:2: 
805.   	/* Build up OCSP query from server certificate */
806.   	x = SSL_get_certificate(s);
807. > 	aia = X509_get1_ocsp(x);
808.   	if (aia)
809.   		{
