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


apps/s_server.c:795:1: start of procedure cert_status_cb()
793.    */
794.   
795. > static int cert_status_cb(SSL *s, void *arg)
796.   	{
797.   	tlsextstatusctx *srctx = arg;

apps/s_server.c:797:2: 
795.   static int cert_status_cb(SSL *s, void *arg)
796.   	{
797. > 	tlsextstatusctx *srctx = arg;
798.   	BIO *err = srctx->err;
799.   	char *host, *port, *path;

apps/s_server.c:798:2: 
796.   	{
797.   	tlsextstatusctx *srctx = arg;
798. > 	BIO *err = srctx->err;
799.   	char *host, *port, *path;
800.   	int use_ssl;

apps/s_server.c:801:2: 
799.   	char *host, *port, *path;
800.   	int use_ssl;
801. > 	unsigned char *rspder = NULL;
802.   	int rspderlen;
803.   	STACK_OF(OPENSSL_STRING) *aia = NULL;

apps/s_server.c:803:2: 
801.   	unsigned char *rspder = NULL;
802.   	int rspderlen;
803. > 	STACK_OF(OPENSSL_STRING) *aia = NULL;
804.   	X509 *x = NULL;
805.   	X509_STORE_CTX inctx;

apps/s_server.c:804:2: 
802.   	int rspderlen;
803.   	STACK_OF(OPENSSL_STRING) *aia = NULL;
804. > 	X509 *x = NULL;
805.   	X509_STORE_CTX inctx;
806.   	X509_OBJECT obj;

apps/s_server.c:807:2: 
805.   	X509_STORE_CTX inctx;
806.   	X509_OBJECT obj;
807. > 	OCSP_REQUEST *req = NULL;
808.   	OCSP_RESPONSE *resp = NULL;
809.   	OCSP_CERTID *id = NULL;

apps/s_server.c:808:2: 
806.   	X509_OBJECT obj;
807.   	OCSP_REQUEST *req = NULL;
808. > 	OCSP_RESPONSE *resp = NULL;
809.   	OCSP_CERTID *id = NULL;
810.   	STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:809:2: 
807.   	OCSP_REQUEST *req = NULL;
808.   	OCSP_RESPONSE *resp = NULL;
809. > 	OCSP_CERTID *id = NULL;
810.   	STACK_OF(X509_EXTENSION) *exts;
811.   	int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:811:2: 
809.   	OCSP_CERTID *id = NULL;
810.   	STACK_OF(X509_EXTENSION) *exts;
811. > 	int ret = SSL_TLSEXT_ERR_NOACK;
812.   	int i;
813.   #if 0

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

apps/s_server.c:819:3: 
817.   #endif
818.   	if (srctx->verbose)
819. > 		BIO_puts(err, "cert_status: callback called\n");
820.   	/* Build up OCSP query from server certificate */
821.   	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:821:2: 
819.   		BIO_puts(err, "cert_status: callback called\n");
820.   	/* Build up OCSP query from server certificate */
821. > 	x = SSL_get_certificate(s);
822.   	aia = X509_get1_ocsp(x);
823.   	if (aia)

ssl/ssl_lib.c:2858:1: start of procedure SSL_get_certificate()
  2856.   
  2857.   /* Fix this function so that it takes an optional type parameter */
  2858. > X509 *SSL_get_certificate(const SSL *s)
  2859.   	{
  2860.   	if (s->cert != NULL)

ssl/ssl_lib.c:2860:6: Taking false branch
  2858.   X509 *SSL_get_certificate(const SSL *s)
  2859.   	{
  2860.   	if (s->cert != NULL)
               ^
  2861.   		return(s->cert->key->x509);
  2862.   	else

ssl/ssl_lib.c:2863:3: 
  2861.   		return(s->cert->key->x509);
  2862.   	else
  2863. > 		return(NULL);
  2864.   	}
  2865.   

ssl/ssl_lib.c:2864:2: return from a call to SSL_get_certificate
  2862.   	else
  2863.   		return(NULL);
  2864.   	}
           ^
  2865.   
  2866.   /* Fix this function so that it takes an optional type parameter */

apps/s_server.c:822:2: 
820.   	/* Build up OCSP query from server certificate */
821.   	x = SSL_get_certificate(s);
822. > 	aia = X509_get1_ocsp(x);
823.   	if (aia)
824.   		{
