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 40 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: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 true branch
  272.   			return(i);
  273.   
  274.   	if (!b->init)
               ^
  275.   		{
  276.   		BIOerr(BIO_F_BIO_PUTS,BIO_R_UNINITIALIZED);

crypto/bio/bio_lib.c:276:3: 
  274.   	if (!b->init)
  275.   		{
  276. > 		BIOerr(BIO_F_BIO_PUTS,BIO_R_UNINITIALIZED);
  277.   		return(-2);
  278.   		}

crypto/err/err.c:705:1: start of procedure ERR_put_error()
    703.   /********************************************************/
    704.   
    705. > void ERR_put_error(int lib, int func, int reason, const char *file,
    706.   	     int line)
    707.   	{

crypto/err/err.c:729:2: Skipping ERR_get_state(): empty list of specs
    727.   	}
    728.   #endif
    729.   	es=ERR_get_state();
            ^
    730.   
    731.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:731:2: 
    729.   	es=ERR_get_state();
    730.   
    731. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    732.   	if (es->top == es->bottom)
    733.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:732:6: Taking false branch
    730.   
    731.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    732.   	if (es->top == es->bottom)
                ^
    733.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    734.   	es->err_flags[es->top]=0;

crypto/err/err.c:734:2: 
    732.   	if (es->top == es->bottom)
    733.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    734. > 	es->err_flags[es->top]=0;
    735.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    736.   	es->err_file[es->top]=file;

crypto/err/err.c:735:2: 
    733.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    734.   	es->err_flags[es->top]=0;
    735. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    736.   	es->err_file[es->top]=file;
    737.   	es->err_line[es->top]=line;

crypto/err/err.c:736:2: 
    734.   	es->err_flags[es->top]=0;
    735.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    736. > 	es->err_file[es->top]=file;
    737.   	es->err_line[es->top]=line;
    738.   	err_clear_data(es,es->top);

crypto/err/err.c:737:2: 
    735.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    736.   	es->err_file[es->top]=file;
    737. > 	es->err_line[es->top]=line;
    738.   	err_clear_data(es,es->top);
    739.   	}

crypto/err/err.c:738:2: Taking true branch
    736.   	es->err_file[es->top]=file;
    737.   	es->err_line[es->top]=line;
    738.   	err_clear_data(es,es->top);
            ^
    739.   	}
    740.   

crypto/err/err.c:738:2: Taking false branch
    736.   	es->err_file[es->top]=file;
    737.   	es->err_line[es->top]=line;
    738.   	err_clear_data(es,es->top);
            ^
    739.   	}
    740.   

crypto/err/err.c:738:2: Loop condition is false. Leaving loop
    736.   	es->err_file[es->top]=file;
    737.   	es->err_line[es->top]=line;
    738.   	err_clear_data(es,es->top);
            ^
    739.   	}
    740.   

crypto/err/err.c:739:2: return from a call to ERR_put_error
    737.   	es->err_line[es->top]=line;
    738.   	err_clear_data(es,es->top);
    739.   	}
            ^
    740.   
    741.   void ERR_clear_error(void)

crypto/bio/bio_lib.c:277:3: 
  275.   		{
  276.   		BIOerr(BIO_F_BIO_PUTS,BIO_R_UNINITIALIZED);
  277. > 		return(-2);
  278.   		}
  279.   

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: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:2512:1: start of procedure SSL_get_certificate()
  2510.   
  2511.   /* Fix this function so that it takes an optional type parameter */
  2512. > X509 *SSL_get_certificate(const SSL *s)
  2513.   	{
  2514.   	if (s->cert != NULL)

ssl/ssl_lib.c:2514:6: Taking false branch
  2512.   X509 *SSL_get_certificate(const SSL *s)
  2513.   	{
  2514.   	if (s->cert != NULL)
               ^
  2515.   		return(s->cert->key->x509);
  2516.   	else

ssl/ssl_lib.c:2517:3: 
  2515.   		return(s->cert->key->x509);
  2516.   	else
  2517. > 		return(NULL);
  2518.   	}
  2519.   

ssl/ssl_lib.c:2518:2: return from a call to SSL_get_certificate
  2516.   	else
  2517.   		return(NULL);
  2518.   	}
           ^
  2519.   
  2520.   /* 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.   		{
