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


apps/s_server.c:614:1: start of procedure cert_status_cb()
612.    */
613.   
614. > static int cert_status_cb(SSL *s, void *arg)
615.   {
616.       tlsextstatusctx *srctx = arg;

apps/s_server.c:616:5: 
614.   static int cert_status_cb(SSL *s, void *arg)
615.   {
616. >     tlsextstatusctx *srctx = arg;
617.       char *host = NULL, *port = NULL, *path = NULL;
618.       int use_ssl;

apps/s_server.c:617:5: 
615.   {
616.       tlsextstatusctx *srctx = arg;
617. >     char *host = NULL, *port = NULL, *path = NULL;
618.       int use_ssl;
619.       unsigned char *rspder = NULL;

apps/s_server.c:619:5: 
617.       char *host = NULL, *port = NULL, *path = NULL;
618.       int use_ssl;
619. >     unsigned char *rspder = NULL;
620.       int rspderlen;
621.       STACK_OF(OPENSSL_STRING) *aia = NULL;

apps/s_server.c:621:5: 
619.       unsigned char *rspder = NULL;
620.       int rspderlen;
621. >     STACK_OF(OPENSSL_STRING) *aia = NULL;
622.       X509 *x = NULL;
623.       X509_STORE_CTX inctx;

apps/s_server.c:622:5: 
620.       int rspderlen;
621.       STACK_OF(OPENSSL_STRING) *aia = NULL;
622. >     X509 *x = NULL;
623.       X509_STORE_CTX inctx;
624.       X509_OBJECT obj;

apps/s_server.c:625:5: 
623.       X509_STORE_CTX inctx;
624.       X509_OBJECT obj;
625. >     OCSP_REQUEST *req = NULL;
626.       OCSP_RESPONSE *resp = NULL;
627.       OCSP_CERTID *id = NULL;

apps/s_server.c:626:5: 
624.       X509_OBJECT obj;
625.       OCSP_REQUEST *req = NULL;
626. >     OCSP_RESPONSE *resp = NULL;
627.       OCSP_CERTID *id = NULL;
628.       STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:627:5: 
625.       OCSP_REQUEST *req = NULL;
626.       OCSP_RESPONSE *resp = NULL;
627. >     OCSP_CERTID *id = NULL;
628.       STACK_OF(X509_EXTENSION) *exts;
629.       int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:629:5: 
627.       OCSP_CERTID *id = NULL;
628.       STACK_OF(X509_EXTENSION) *exts;
629. >     int ret = SSL_TLSEXT_ERR_NOACK;
630.       int i;
631.   

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

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

crypto/bio/bio_lib.c:272:1: start of procedure BIO_puts()
  270.   }
  271.   
  272. > int BIO_puts(BIO *b, const char *in)
  273.   {
  274.       int i;

crypto/bio/bio_lib.c:277:10: Taking false branch
  275.       long (*cb) (BIO *, int, const char *, int, long, long);
  276.   
  277.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                  ^
  278.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  279.           return (-2);

crypto/bio/bio_lib.c:277:25: Taking false branch
  275.       long (*cb) (BIO *, int, const char *, int, long, long);
  276.   
  277.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                                 ^
  278.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  279.           return (-2);

crypto/bio/bio_lib.c:277:48: Taking false branch
  275.       long (*cb) (BIO *, int, const char *, int, long, long);
  276.   
  277.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                                                        ^
  278.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
  279.           return (-2);

crypto/bio/bio_lib.c:282:5: 
  280.       }
  281.   
  282. >     cb = b->callback;
  283.   
  284.       if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0))

crypto/bio/bio_lib.c:284:10: Taking false branch
  282.       cb = b->callback;
  283.   
  284.       if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0))
                  ^
  285.           return (i);
  286.   

crypto/bio/bio_lib.c:287:10: Taking true branch
  285.           return (i);
  286.   
  287.       if (!b->init) {
                  ^
  288.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
  289.           return (-2);

crypto/bio/bio_lib.c:288:9: Skipping ERR_put_error(): empty list of specs
  286.   
  287.       if (!b->init) {
  288.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
                 ^
  289.           return (-2);
  290.       }

crypto/bio/bio_lib.c:289:9: 
  287.       if (!b->init) {
  288.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
  289. >         return (-2);
  290.       }
  291.   

crypto/bio/bio_lib.c:300:1: return from a call to BIO_puts
  298.           i = (int)cb(b, BIO_CB_PUTS | BIO_CB_RETURN, in, 0, 0L, (long)i);
  299.       return (i);
  300. > }
  301.   
  302.   int BIO_gets(BIO *b, char *in, int inl)

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

ssl/ssl_lib.c:3229:1: start of procedure SSL_get_certificate()
  3227.   }
  3228.   
  3229. > X509 *SSL_get_certificate(const SSL *s)
  3230.   {
  3231.       if (s->cert != NULL)

ssl/ssl_lib.c:3231:9: Taking false branch
  3229.   X509 *SSL_get_certificate(const SSL *s)
  3230.   {
  3231.       if (s->cert != NULL)
                  ^
  3232.           return (s->cert->key->x509);
  3233.       else

ssl/ssl_lib.c:3234:9: 
  3232.           return (s->cert->key->x509);
  3233.       else
  3234. >         return (NULL);
  3235.   }
  3236.   

ssl/ssl_lib.c:3235:1: return from a call to SSL_get_certificate
  3233.       else
  3234.           return (NULL);
  3235. > }
  3236.   
  3237.   EVP_PKEY *SSL_get_privatekey(const SSL *s)

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

crypto/x509v3/v3_utl.c:534:1: start of procedure X509_get1_ocsp()
  532.   }
  533.   
  534. > STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x)
  535.   {
  536.       AUTHORITY_INFO_ACCESS *info;

crypto/x509v3/v3_utl.c:537:5: 
  535.   {
  536.       AUTHORITY_INFO_ACCESS *info;
  537. >     STACK_OF(OPENSSL_STRING) *ret = NULL;
  538.       int i;
  539.   

crypto/x509v3/v3_utl.c:540:5: 
  538.       int i;
  539.   
  540. >     info = X509_get_ext_d2i(x, NID_info_access, NULL, NULL);
  541.       if (!info)
  542.           return NULL;

crypto/x509/x509_ext.c:150:1: start of procedure X509_get_ext_d2i()
    148.   }
    149.   
    150. > void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx)
    151.   {
    152.       return X509V3_get_d2i(x->cert_info.extensions, nid, crit, idx);

crypto/x509/x509_ext.c:152:5: 
    150.   void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx)
    151.   {
    152. >     return X509V3_get_d2i(x->cert_info.extensions, nid, crit, idx);
    153.   }
    154.   
