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


apps/s_server.c:618:1: start of procedure cert_status_cb()
616.    */
617.   
618. > static int cert_status_cb(SSL *s, void *arg)
619.   {
620.       tlsextstatusctx *srctx = arg;

apps/s_server.c:620:5: 
618.   static int cert_status_cb(SSL *s, void *arg)
619.   {
620. >     tlsextstatusctx *srctx = arg;
621.       char *host = NULL, *port = NULL, *path = NULL;
622.       int use_ssl;

apps/s_server.c:621:5: 
619.   {
620.       tlsextstatusctx *srctx = arg;
621. >     char *host = NULL, *port = NULL, *path = NULL;
622.       int use_ssl;
623.       unsigned char *rspder = NULL;

apps/s_server.c:623:5: 
621.       char *host = NULL, *port = NULL, *path = NULL;
622.       int use_ssl;
623. >     unsigned char *rspder = NULL;
624.       int rspderlen;
625.       STACK_OF(OPENSSL_STRING) *aia = NULL;

apps/s_server.c:625:5: 
623.       unsigned char *rspder = NULL;
624.       int rspderlen;
625. >     STACK_OF(OPENSSL_STRING) *aia = NULL;
626.       X509 *x = NULL;
627.       X509_STORE_CTX inctx;

apps/s_server.c:626:5: 
624.       int rspderlen;
625.       STACK_OF(OPENSSL_STRING) *aia = NULL;
626. >     X509 *x = NULL;
627.       X509_STORE_CTX inctx;
628.       X509_OBJECT obj;

apps/s_server.c:629:5: 
627.       X509_STORE_CTX inctx;
628.       X509_OBJECT obj;
629. >     OCSP_REQUEST *req = NULL;
630.       OCSP_RESPONSE *resp = NULL;
631.       OCSP_CERTID *id = NULL;

apps/s_server.c:630:5: 
628.       X509_OBJECT obj;
629.       OCSP_REQUEST *req = NULL;
630. >     OCSP_RESPONSE *resp = NULL;
631.       OCSP_CERTID *id = NULL;
632.       STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:631:5: 
629.       OCSP_REQUEST *req = NULL;
630.       OCSP_RESPONSE *resp = NULL;
631. >     OCSP_CERTID *id = NULL;
632.       STACK_OF(X509_EXTENSION) *exts;
633.       int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:633:5: 
631.       OCSP_CERTID *id = NULL;
632.       STACK_OF(X509_EXTENSION) *exts;
633. >     int ret = SSL_TLSEXT_ERR_NOACK;
634.       int i;
635.   

apps/s_server.c:636:9: Taking true branch
634.       int i;
635.   
636.       if (srctx->verbose)
               ^
637.           BIO_puts(bio_err, "cert_status: callback called\n");
638.       /* Build up OCSP query from server certificate */

apps/s_server.c:637:9: 
635.   
636.       if (srctx->verbose)
637. >         BIO_puts(bio_err, "cert_status: callback called\n");
638.       /* Build up OCSP query from server certificate */
639.       x = SSL_get_certificate(s);

crypto/bio/bio_lib.c:252:1: start of procedure BIO_puts()
  250.   }
  251.   
  252. > int BIO_puts(BIO *b, const char *in)
  253.   {
  254.       int i;

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

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

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

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

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

crypto/bio/bio_lib.c:267:10: Taking false branch
  265.           return (i);
  266.   
  267.       if (!b->init) {
                  ^
  268.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
  269.           return (-2);

crypto/bio/bio_lib.c:272:5: Skipping __function_pointer__(): unresolved function pointer
  270.       }
  271.   
  272.       i = b->method->bputs(b, in);
             ^
  273.   
  274.       if (i > 0)

crypto/bio/bio_lib.c:274:9: Taking true branch
  272.       i = b->method->bputs(b, in);
  273.   
  274.       if (i > 0)
                 ^
  275.           b->num_write += (uint64_t)i;
  276.   

crypto/bio/bio_lib.c:275:9: 
  273.   
  274.       if (i > 0)
  275. >         b->num_write += (uint64_t)i;
  276.   
  277.       if (cb != NULL)

crypto/bio/bio_lib.c:277:9: Taking false branch
  275.           b->num_write += (uint64_t)i;
  276.   
  277.       if (cb != NULL)
                 ^
  278.           i = (int)cb(b, BIO_CB_PUTS | BIO_CB_RETURN, in, 0, 0L, (long)i);
  279.       return (i);

crypto/bio/bio_lib.c:279:5: 
  277.       if (cb != NULL)
  278.           i = (int)cb(b, BIO_CB_PUTS | BIO_CB_RETURN, in, 0, 0L, (long)i);
  279. >     return (i);
  280.   }
  281.   

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

apps/s_server.c:639:5: 
637.           BIO_puts(bio_err, "cert_status: callback called\n");
638.       /* Build up OCSP query from server certificate */
639. >     x = SSL_get_certificate(s);
640.       aia = X509_get1_ocsp(x);
641.       if (aia) {

ssl/ssl_lib.c:2748:1: start of procedure SSL_get_certificate()
  2746.   }
  2747.   
  2748. > X509 *SSL_get_certificate(const SSL *s)
  2749.   {
  2750.       if (s->cert != NULL)

ssl/ssl_lib.c:2750:9: Taking false branch
  2748.   X509 *SSL_get_certificate(const SSL *s)
  2749.   {
  2750.       if (s->cert != NULL)
                  ^
  2751.           return (s->cert->key->x509);
  2752.       else

ssl/ssl_lib.c:2753:9: 
  2751.           return (s->cert->key->x509);
  2752.       else
  2753. >         return (NULL);
  2754.   }
  2755.   

ssl/ssl_lib.c:2754:1: return from a call to SSL_get_certificate
  2752.       else
  2753.           return (NULL);
  2754. > }
  2755.   
  2756.   EVP_PKEY *SSL_get_privatekey(const SSL *s)

apps/s_server.c:640:5: 
638.       /* Build up OCSP query from server certificate */
639.       x = SSL_get_certificate(s);
640. >     aia = X509_get1_ocsp(x);
641.       if (aia) {
642.           if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0),
