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


apps/s_server.c:515:1: start of procedure cert_status_cb()
513.    */
514.   
515. > static int cert_status_cb(SSL *s, void *arg)
516.   {
517.       tlsextstatusctx *srctx = arg;

apps/s_server.c:517:5: 
515.   static int cert_status_cb(SSL *s, void *arg)
516.   {
517. >     tlsextstatusctx *srctx = arg;
518.       char *host = NULL, *port = NULL, *path = NULL;
519.       int use_ssl;

apps/s_server.c:518:5: 
516.   {
517.       tlsextstatusctx *srctx = arg;
518. >     char *host = NULL, *port = NULL, *path = NULL;
519.       int use_ssl;
520.       unsigned char *rspder = NULL;

apps/s_server.c:520:5: 
518.       char *host = NULL, *port = NULL, *path = NULL;
519.       int use_ssl;
520. >     unsigned char *rspder = NULL;
521.       int rspderlen;
522.       STACK_OF(OPENSSL_STRING) *aia = NULL;

apps/s_server.c:522:5: 
520.       unsigned char *rspder = NULL;
521.       int rspderlen;
522. >     STACK_OF(OPENSSL_STRING) *aia = NULL;
523.       X509 *x = NULL;
524.       X509_STORE_CTX *inctx = NULL;

apps/s_server.c:523:5: 
521.       int rspderlen;
522.       STACK_OF(OPENSSL_STRING) *aia = NULL;
523. >     X509 *x = NULL;
524.       X509_STORE_CTX *inctx = NULL;
525.       X509_OBJECT *obj;

apps/s_server.c:524:5: 
522.       STACK_OF(OPENSSL_STRING) *aia = NULL;
523.       X509 *x = NULL;
524. >     X509_STORE_CTX *inctx = NULL;
525.       X509_OBJECT *obj;
526.       OCSP_REQUEST *req = NULL;

apps/s_server.c:526:5: 
524.       X509_STORE_CTX *inctx = NULL;
525.       X509_OBJECT *obj;
526. >     OCSP_REQUEST *req = NULL;
527.       OCSP_RESPONSE *resp = NULL;
528.       OCSP_CERTID *id = NULL;

apps/s_server.c:527:5: 
525.       X509_OBJECT *obj;
526.       OCSP_REQUEST *req = NULL;
527. >     OCSP_RESPONSE *resp = NULL;
528.       OCSP_CERTID *id = NULL;
529.       STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:528:5: 
526.       OCSP_REQUEST *req = NULL;
527.       OCSP_RESPONSE *resp = NULL;
528. >     OCSP_CERTID *id = NULL;
529.       STACK_OF(X509_EXTENSION) *exts;
530.       int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:530:5: 
528.       OCSP_CERTID *id = NULL;
529.       STACK_OF(X509_EXTENSION) *exts;
530. >     int ret = SSL_TLSEXT_ERR_NOACK;
531.       int i;
532.   

apps/s_server.c:533:9: Taking true branch
531.       int i;
532.   
533.       if (srctx->verbose)
               ^
534.           BIO_puts(bio_err, "cert_status: callback called\n");
535.       /* Build up OCSP query from server certificate */

apps/s_server.c:534:9: 
532.   
533.       if (srctx->verbose)
534. >         BIO_puts(bio_err, "cert_status: callback called\n");
535.       /* Build up OCSP query from server certificate */
536.       x = SSL_get_certificate(s);

crypto/bio/bio_lib.c:256:1: start of procedure BIO_puts()
  254.   }
  255.   
  256. > int BIO_puts(BIO *b, const char *in)
  257.   {
  258.       int i;

crypto/bio/bio_lib.c:261:10: Taking false branch
  259.       long (*cb) (BIO *, int, const char *, int, long, long);
  260.   
  261.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                  ^
  262.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  263.           return (-2);

crypto/bio/bio_lib.c:261:25: Taking false branch
  259.       long (*cb) (BIO *, int, const char *, int, long, long);
  260.   
  261.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                                 ^
  262.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  263.           return (-2);

crypto/bio/bio_lib.c:261:48: Taking false branch
  259.       long (*cb) (BIO *, int, const char *, int, long, long);
  260.   
  261.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                                                        ^
  262.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  263.           return (-2);

crypto/bio/bio_lib.c:266:5: 
  264.       }
  265.   
  266. >     cb = b->callback;
  267.   
  268.       if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0))

crypto/bio/bio_lib.c:268:10: Taking false branch
  266.       cb = b->callback;
  267.   
  268.       if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0))
                  ^
  269.           return (i);
  270.   

crypto/bio/bio_lib.c:271:10: Taking true branch
  269.           return (i);
  270.   
  271.       if (!b->init) {
                  ^
  272.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
  273.           return (-2);

crypto/bio/bio_lib.c:272:9: Skipping ERR_put_error(): empty list of specs
  270.   
  271.       if (!b->init) {
  272.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
                 ^
  273.           return (-2);
  274.       }

crypto/bio/bio_lib.c:273:9: 
  271.       if (!b->init) {
  272.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
  273. >         return (-2);
  274.       }
  275.   

crypto/bio/bio_lib.c:284:1: return from a call to BIO_puts
  282.           i = (int)cb(b, BIO_CB_PUTS | BIO_CB_RETURN, in, 0, 0L, (long)i);
  283.       return (i);
  284. > }
  285.   
  286.   int BIO_gets(BIO *b, char *in, int inl)

apps/s_server.c:536:5: 
534.           BIO_puts(bio_err, "cert_status: callback called\n");
535.       /* Build up OCSP query from server certificate */
536. >     x = SSL_get_certificate(s);
537.       aia = X509_get1_ocsp(x);
538.       if (aia) {

ssl/ssl_lib.c:3211:1: start of procedure SSL_get_certificate()
  3209.   }
  3210.   
  3211. > X509 *SSL_get_certificate(const SSL *s)
  3212.   {
  3213.       if (s->cert != NULL)

ssl/ssl_lib.c:3213:9: Taking false branch
  3211.   X509 *SSL_get_certificate(const SSL *s)
  3212.   {
  3213.       if (s->cert != NULL)
                  ^
  3214.           return (s->cert->key->x509);
  3215.       else

ssl/ssl_lib.c:3216:9: 
  3214.           return (s->cert->key->x509);
  3215.       else
  3216. >         return (NULL);
  3217.   }
  3218.   

ssl/ssl_lib.c:3217:1: return from a call to SSL_get_certificate
  3215.       else
  3216.           return (NULL);
  3217. > }
  3218.   
  3219.   EVP_PKEY *SSL_get_privatekey(const SSL *s)

apps/s_server.c:537:5: 
535.       /* Build up OCSP query from server certificate */
536.       x = SSL_get_certificate(s);
537. >     aia = X509_get1_ocsp(x);
538.       if (aia) {
539.           if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0),
