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


apps/s_server.c:707:1: start of procedure cert_status_cb()
705.    */
706.   
707. > static int cert_status_cb(SSL *s, void *arg)
708.   	{
709.   	tlsextstatusctx *srctx = arg;

apps/s_server.c:709:2: 
707.   static int cert_status_cb(SSL *s, void *arg)
708.   	{
709. > 	tlsextstatusctx *srctx = arg;
710.   	BIO *err = srctx->err;
711.   	char *host, *port, *path;

apps/s_server.c:710:2: 
708.   	{
709.   	tlsextstatusctx *srctx = arg;
710. > 	BIO *err = srctx->err;
711.   	char *host, *port, *path;
712.   	int use_ssl;

apps/s_server.c:713:2: 
711.   	char *host, *port, *path;
712.   	int use_ssl;
713. > 	unsigned char *rspder = NULL;
714.   	int rspderlen;
715.   	STACK_OF(OPENSSL_STRING) *aia = NULL;

apps/s_server.c:715:2: 
713.   	unsigned char *rspder = NULL;
714.   	int rspderlen;
715. > 	STACK_OF(OPENSSL_STRING) *aia = NULL;
716.   	X509 *x = NULL;
717.   	X509_STORE_CTX inctx;

apps/s_server.c:716:2: 
714.   	int rspderlen;
715.   	STACK_OF(OPENSSL_STRING) *aia = NULL;
716. > 	X509 *x = NULL;
717.   	X509_STORE_CTX inctx;
718.   	X509_OBJECT obj;

apps/s_server.c:719:2: 
717.   	X509_STORE_CTX inctx;
718.   	X509_OBJECT obj;
719. > 	OCSP_REQUEST *req = NULL;
720.   	OCSP_RESPONSE *resp = NULL;
721.   	OCSP_CERTID *id = NULL;

apps/s_server.c:720:2: 
718.   	X509_OBJECT obj;
719.   	OCSP_REQUEST *req = NULL;
720. > 	OCSP_RESPONSE *resp = NULL;
721.   	OCSP_CERTID *id = NULL;
722.   	STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:721:2: 
719.   	OCSP_REQUEST *req = NULL;
720.   	OCSP_RESPONSE *resp = NULL;
721. > 	OCSP_CERTID *id = NULL;
722.   	STACK_OF(X509_EXTENSION) *exts;
723.   	int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:723:2: 
721.   	OCSP_CERTID *id = NULL;
722.   	STACK_OF(X509_EXTENSION) *exts;
723. > 	int ret = SSL_TLSEXT_ERR_NOACK;
724.   	int i;
725.   #if 0

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

apps/s_server.c:731:3: 
729.   #endif
730.   	if (srctx->verbose)
731. > 		BIO_puts(err, "cert_status: callback called\n");
732.   	/* Build up OCSP query from server certificate */
733.   	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:733:2: 
731.   		BIO_puts(err, "cert_status: callback called\n");
732.   	/* Build up OCSP query from server certificate */
733. > 	x = SSL_get_certificate(s);
734.   	aia = X509_get1_ocsp(x);
735.   	if (aia)

ssl/ssl_lib.c:2551:1: start of procedure SSL_get_certificate()
  2549.   
  2550.   /* Fix this function so that it takes an optional type parameter */
  2551. > X509 *SSL_get_certificate(const SSL *s)
  2552.   	{
  2553.   	if (s->cert != NULL)

ssl/ssl_lib.c:2553:6: Taking false branch
  2551.   X509 *SSL_get_certificate(const SSL *s)
  2552.   	{
  2553.   	if (s->cert != NULL)
               ^
  2554.   		return(s->cert->key->x509);
  2555.   	else

ssl/ssl_lib.c:2556:3: 
  2554.   		return(s->cert->key->x509);
  2555.   	else
  2556. > 		return(NULL);
  2557.   	}
  2558.   

ssl/ssl_lib.c:2557:2: return from a call to SSL_get_certificate
  2555.   	else
  2556.   		return(NULL);
  2557.   	}
           ^
  2558.   
  2559.   /* Fix this function so that it takes an optional type parameter */

apps/s_server.c:734:2: 
732.   	/* Build up OCSP query from server certificate */
733.   	x = SSL_get_certificate(s);
734. > 	aia = X509_get1_ocsp(x);
735.   	if (aia)
736.   		{
