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


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

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

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

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

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

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

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

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

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

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

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

apps/s_server.c:817:3: 
815.   #endif
816.   	if (srctx->verbose)
817. > 		BIO_puts(err, "cert_status: callback called\n");
818.   	/* Build up OCSP query from server certificate */
819.   	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 false 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:274:7: Taking false branch
  272.   			return(i);
  273.   
  274.   	if (!b->init)
               ^
  275.   		{
  276.   		BIOerr(BIO_F_BIO_PUTS,BIO_R_UNINITIALIZED);

crypto/bio/bio_lib.c:280:2: Skipping __function_pointer__(): unresolved function pointer
  278.   		}
  279.   
  280.   	i=b->method->bputs(b,in);
          ^
  281.   
  282.   	if (i > 0) b->num_write+=(unsigned long)i;

crypto/bio/bio_lib.c:282:6: Taking true branch
  280.   	i=b->method->bputs(b,in);
  281.   
  282.   	if (i > 0) b->num_write+=(unsigned long)i;
              ^
  283.   
  284.   	if (cb != NULL)

crypto/bio/bio_lib.c:282:13: 
  280.   	i=b->method->bputs(b,in);
  281.   
  282. > 	if (i > 0) b->num_write+=(unsigned long)i;
  283.   
  284.   	if (cb != NULL)

crypto/bio/bio_lib.c:284:6: Taking false branch
  282.   	if (i > 0) b->num_write+=(unsigned long)i;
  283.   
  284.   	if (cb != NULL)
              ^
  285.   		i=(int)cb(b,BIO_CB_PUTS|BIO_CB_RETURN,in,0,
  286.   			0L,(long)i);

crypto/bio/bio_lib.c:287:2: 
  285.   		i=(int)cb(b,BIO_CB_PUTS|BIO_CB_RETURN,in,0,
  286.   			0L,(long)i);
  287. > 	return(i);
  288.   	}
  289.   

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

ssl/ssl_lib.c:2879:1: start of procedure SSL_get_certificate()
  2877.   
  2878.   /* Fix this function so that it takes an optional type parameter */
  2879. > X509 *SSL_get_certificate(const SSL *s)
  2880.   	{
  2881.   	if (s->cert != NULL)

ssl/ssl_lib.c:2881:6: Taking false branch
  2879.   X509 *SSL_get_certificate(const SSL *s)
  2880.   	{
  2881.   	if (s->cert != NULL)
               ^
  2882.   		return(s->cert->key->x509);
  2883.   	else

ssl/ssl_lib.c:2884:3: 
  2882.   		return(s->cert->key->x509);
  2883.   	else
  2884. > 		return(NULL);
  2885.   	}
  2886.   

ssl/ssl_lib.c:2885:2: return from a call to SSL_get_certificate
  2883.   	else
  2884.   		return(NULL);
  2885.   	}
           ^
  2886.   
  2887.   /* Fix this function so that it takes an optional type parameter */

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