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


apps/s_server.c:718:1: start of procedure cert_status_cb()
716.    */
717.   
718. > static int cert_status_cb(SSL *s, void *arg)
719.   	{
720.   	tlsextstatusctx *srctx = arg;

apps/s_server.c:720:2: 
718.   static int cert_status_cb(SSL *s, void *arg)
719.   	{
720. > 	tlsextstatusctx *srctx = arg;
721.   	BIO *err = srctx->err;
722.   	char *host, *port, *path;

apps/s_server.c:721:2: 
719.   	{
720.   	tlsextstatusctx *srctx = arg;
721. > 	BIO *err = srctx->err;
722.   	char *host, *port, *path;
723.   	int use_ssl;

apps/s_server.c:724:2: 
722.   	char *host, *port, *path;
723.   	int use_ssl;
724. > 	unsigned char *rspder = NULL;
725.   	int rspderlen;
726.   	STACK_OF(OPENSSL_STRING) *aia = NULL;

apps/s_server.c:726:2: 
724.   	unsigned char *rspder = NULL;
725.   	int rspderlen;
726. > 	STACK_OF(OPENSSL_STRING) *aia = NULL;
727.   	X509 *x = NULL;
728.   	X509_STORE_CTX inctx;

apps/s_server.c:727:2: 
725.   	int rspderlen;
726.   	STACK_OF(OPENSSL_STRING) *aia = NULL;
727. > 	X509 *x = NULL;
728.   	X509_STORE_CTX inctx;
729.   	X509_OBJECT obj;

apps/s_server.c:730:2: 
728.   	X509_STORE_CTX inctx;
729.   	X509_OBJECT obj;
730. > 	OCSP_REQUEST *req = NULL;
731.   	OCSP_RESPONSE *resp = NULL;
732.   	OCSP_CERTID *id = NULL;

apps/s_server.c:731:2: 
729.   	X509_OBJECT obj;
730.   	OCSP_REQUEST *req = NULL;
731. > 	OCSP_RESPONSE *resp = NULL;
732.   	OCSP_CERTID *id = NULL;
733.   	STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:732:2: 
730.   	OCSP_REQUEST *req = NULL;
731.   	OCSP_RESPONSE *resp = NULL;
732. > 	OCSP_CERTID *id = NULL;
733.   	STACK_OF(X509_EXTENSION) *exts;
734.   	int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:734:2: 
732.   	OCSP_CERTID *id = NULL;
733.   	STACK_OF(X509_EXTENSION) *exts;
734. > 	int ret = SSL_TLSEXT_ERR_NOACK;
735.   	int i;
736.   #if 0

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

apps/s_server.c:742:3: 
740.   #endif
741.   	if (srctx->verbose)
742. > 		BIO_puts(err, "cert_status: callback called\n");
743.   	/* Build up OCSP query from server certificate */
744.   	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:744:2: 
742.   		BIO_puts(err, "cert_status: callback called\n");
743.   	/* Build up OCSP query from server certificate */
744. > 	x = SSL_get_certificate(s);
745.   	aia = X509_get1_ocsp(x);
746.   	if (aia)

ssl/ssl_lib.c:2740:1: start of procedure SSL_get_certificate()
  2738.   
  2739.   /* Fix this function so that it takes an optional type parameter */
  2740. > X509 *SSL_get_certificate(const SSL *s)
  2741.   	{
  2742.   	if (s->cert != NULL)

ssl/ssl_lib.c:2742:6: Taking false branch
  2740.   X509 *SSL_get_certificate(const SSL *s)
  2741.   	{
  2742.   	if (s->cert != NULL)
               ^
  2743.   		return(s->cert->key->x509);
  2744.   	else

ssl/ssl_lib.c:2745:3: 
  2743.   		return(s->cert->key->x509);
  2744.   	else
  2745. > 		return(NULL);
  2746.   	}
  2747.   

ssl/ssl_lib.c:2746:2: return from a call to SSL_get_certificate
  2744.   	else
  2745.   		return(NULL);
  2746.   	}
           ^
  2747.   
  2748.   /* Fix this function so that it takes an optional type parameter */

apps/s_server.c:745:2: 
743.   	/* Build up OCSP query from server certificate */
744.   	x = SSL_get_certificate(s);
745. > 	aia = X509_get1_ocsp(x);
746.   	if (aia)
747.   		{
