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


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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/bio/bio_lib.c:240:1: start of procedure BIO_puts()
  238.   }
  239.   
  240. > int BIO_puts(BIO *b, const char *in)
  241.   {
  242.       int i;

crypto/bio/bio_lib.c:245:10: Taking false branch
  243.       long (*cb) (BIO *, int, const char *, int, long, long);
  244.   
  245.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                  ^
  246.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  247.           return (-2);

crypto/bio/bio_lib.c:245:25: Taking false branch
  243.       long (*cb) (BIO *, int, const char *, int, long, long);
  244.   
  245.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                                 ^
  246.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  247.           return (-2);

crypto/bio/bio_lib.c:245:48: Taking false branch
  243.       long (*cb) (BIO *, int, const char *, int, long, long);
  244.   
  245.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                                                        ^
  246.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  247.           return (-2);

crypto/bio/bio_lib.c:250:5: 
  248.       }
  249.   
  250. >     cb = b->callback;
  251.   
  252.       if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0))

crypto/bio/bio_lib.c:252:10: Taking false branch
  250.       cb = b->callback;
  251.   
  252.       if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0))
                  ^
  253.           return (i);
  254.   

crypto/bio/bio_lib.c:255:10: Taking true branch
  253.           return (i);
  254.   
  255.       if (!b->init) {
                  ^
  256.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
  257.           return (-2);

crypto/bio/bio_lib.c:256:9: Skipping ERR_put_error(): empty list of specs
  254.   
  255.       if (!b->init) {
  256.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
                 ^
  257.           return (-2);
  258.       }

crypto/bio/bio_lib.c:257:9: 
  255.       if (!b->init) {
  256.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
  257. >         return (-2);
  258.       }
  259.   

crypto/bio/bio_lib.c:268:1: return from a call to BIO_puts
  266.           i = (int)cb(b, BIO_CB_PUTS | BIO_CB_RETURN, in, 0, 0L, (long)i);
  267.       return (i);
  268. > }
  269.   
  270.   int BIO_gets(BIO *b, char *in, int inl)

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

ssl/ssl_lib.c:3246:1: start of procedure SSL_get_certificate()
  3244.   }
  3245.   
  3246. > X509 *SSL_get_certificate(const SSL *s)
  3247.   {
  3248.       if (s->cert != NULL)

ssl/ssl_lib.c:3248:9: Taking false branch
  3246.   X509 *SSL_get_certificate(const SSL *s)
  3247.   {
  3248.       if (s->cert != NULL)
                  ^
  3249.           return (s->cert->key->x509);
  3250.       else

ssl/ssl_lib.c:3251:9: 
  3249.           return (s->cert->key->x509);
  3250.       else
  3251. >         return (NULL);
  3252.   }
  3253.   

ssl/ssl_lib.c:3252:1: return from a call to SSL_get_certificate
  3250.       else
  3251.           return (NULL);
  3252. > }
  3253.   
  3254.   EVP_PKEY *SSL_get_privatekey(const SSL *s)

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