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


apps/s_server.c:473:1: start of procedure cert_status_cb()
471.    */
472.   
473. > static int cert_status_cb(SSL *s, void *arg)
474.   {
475.       tlsextstatusctx *srctx = arg;

apps/s_server.c:475:5: 
473.   static int cert_status_cb(SSL *s, void *arg)
474.   {
475. >     tlsextstatusctx *srctx = arg;
476.       char *host = NULL, *port = NULL, *path = NULL;
477.       int use_ssl;

apps/s_server.c:476:5: 
474.   {
475.       tlsextstatusctx *srctx = arg;
476. >     char *host = NULL, *port = NULL, *path = NULL;
477.       int use_ssl;
478.       unsigned char *rspder = NULL;

apps/s_server.c:478:5: 
476.       char *host = NULL, *port = NULL, *path = NULL;
477.       int use_ssl;
478. >     unsigned char *rspder = NULL;
479.       int rspderlen;
480.       STACK_OF(OPENSSL_STRING) *aia = NULL;

apps/s_server.c:480:5: 
478.       unsigned char *rspder = NULL;
479.       int rspderlen;
480. >     STACK_OF(OPENSSL_STRING) *aia = NULL;
481.       X509 *x = NULL;
482.       X509_STORE_CTX *inctx = NULL;

apps/s_server.c:481:5: 
479.       int rspderlen;
480.       STACK_OF(OPENSSL_STRING) *aia = NULL;
481. >     X509 *x = NULL;
482.       X509_STORE_CTX *inctx = NULL;
483.       X509_OBJECT *obj;

apps/s_server.c:482:5: 
480.       STACK_OF(OPENSSL_STRING) *aia = NULL;
481.       X509 *x = NULL;
482. >     X509_STORE_CTX *inctx = NULL;
483.       X509_OBJECT *obj;
484.       OCSP_REQUEST *req = NULL;

apps/s_server.c:484:5: 
482.       X509_STORE_CTX *inctx = NULL;
483.       X509_OBJECT *obj;
484. >     OCSP_REQUEST *req = NULL;
485.       OCSP_RESPONSE *resp = NULL;
486.       OCSP_CERTID *id = NULL;

apps/s_server.c:485:5: 
483.       X509_OBJECT *obj;
484.       OCSP_REQUEST *req = NULL;
485. >     OCSP_RESPONSE *resp = NULL;
486.       OCSP_CERTID *id = NULL;
487.       STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:486:5: 
484.       OCSP_REQUEST *req = NULL;
485.       OCSP_RESPONSE *resp = NULL;
486. >     OCSP_CERTID *id = NULL;
487.       STACK_OF(X509_EXTENSION) *exts;
488.       int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:488:5: 
486.       OCSP_CERTID *id = NULL;
487.       STACK_OF(X509_EXTENSION) *exts;
488. >     int ret = SSL_TLSEXT_ERR_NOACK;
489.       int i;
490.   

apps/s_server.c:491:9: Taking true branch
489.       int i;
490.   
491.       if (srctx->verbose)
               ^
492.           BIO_puts(bio_err, "cert_status: callback called\n");
493.       /* Build up OCSP query from server certificate */

apps/s_server.c:492:9: 
490.   
491.       if (srctx->verbose)
492. >         BIO_puts(bio_err, "cert_status: callback called\n");
493.       /* Build up OCSP query from server certificate */
494.       x = SSL_get_certificate(s);

crypto/bio/bio_lib.c:386:1: start of procedure BIO_puts()
  384.   }
  385.   
  386. > int BIO_puts(BIO *b, const char *buf)
  387.   {
  388.       int ret;

crypto/bio/bio_lib.c:389:5: 
  387.   {
  388.       int ret;
  389. >     size_t written = 0;
  390.   
  391.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {

crypto/bio/bio_lib.c:391:10: Taking false branch
  389.       size_t written = 0;
  390.   
  391.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                  ^
  392.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  393.           return -2;

crypto/bio/bio_lib.c:391:25: Taking false branch
  389.       size_t written = 0;
  390.   
  391.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                                 ^
  392.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  393.           return -2;

crypto/bio/bio_lib.c:391:48: Taking false branch
  389.       size_t written = 0;
  390.   
  391.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                                                        ^
  392.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  393.           return -2;

crypto/bio/bio_lib.c:396:9: Taking false branch
  394.       }
  395.   
  396.       if (b->callback != NULL || b->callback_ex != NULL) {
                 ^
  397.           ret = (int)bio_call_callback(b, BIO_CB_PUTS, buf, 0, 0, 0L, 1L, NULL);
  398.           if (ret <= 0)

crypto/bio/bio_lib.c:396:32: Taking false branch
  394.       }
  395.   
  396.       if (b->callback != NULL || b->callback_ex != NULL) {
                                        ^
  397.           ret = (int)bio_call_callback(b, BIO_CB_PUTS, buf, 0, 0, 0L, 1L, NULL);
  398.           if (ret <= 0)

crypto/bio/bio_lib.c:402:10: Taking true branch
  400.       }
  401.   
  402.       if (!b->init) {
                  ^
  403.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
  404.           return -2;

crypto/bio/bio_lib.c:403:9: Skipping ERR_put_error(): empty list of specs
  401.   
  402.       if (!b->init) {
  403.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
                 ^
  404.           return -2;
  405.       }

crypto/bio/bio_lib.c:404:9: 
  402.       if (!b->init) {
  403.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
  404. >         return -2;
  405.       }
  406.   

crypto/bio/bio_lib.c:429:1: return from a call to BIO_puts
  427.   
  428.       return ret;
  429. > }
  430.   
  431.   int BIO_gets(BIO *b, char *buf, int size)

apps/s_server.c:494:5: 
492.           BIO_puts(bio_err, "cert_status: callback called\n");
493.       /* Build up OCSP query from server certificate */
494. >     x = SSL_get_certificate(s);
495.       aia = X509_get1_ocsp(x);
496.       if (aia) {

ssl/ssl_lib.c:3255:1: start of procedure SSL_get_certificate()
  3253.   }
  3254.   
  3255. > X509 *SSL_get_certificate(const SSL *s)
  3256.   {
  3257.       if (s->cert != NULL)

ssl/ssl_lib.c:3257:9: Taking false branch
  3255.   X509 *SSL_get_certificate(const SSL *s)
  3256.   {
  3257.       if (s->cert != NULL)
                  ^
  3258.           return (s->cert->key->x509);
  3259.       else

ssl/ssl_lib.c:3260:9: 
  3258.           return (s->cert->key->x509);
  3259.       else
  3260. >         return (NULL);
  3261.   }
  3262.   

ssl/ssl_lib.c:3261:1: return from a call to SSL_get_certificate
  3259.       else
  3260.           return (NULL);
  3261. > }
  3262.   
  3263.   EVP_PKEY *SSL_get_privatekey(const SSL *s)

apps/s_server.c:495:5: 
493.       /* Build up OCSP query from server certificate */
494.       x = SSL_get_certificate(s);
495. >     aia = X509_get1_ocsp(x);
496.       if (aia) {
497.           if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0),
