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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/bio/bio_lib.c:267:9: Skipping ERR_put_error(): empty list of specs
  265.   
  266.       if (!b->init) {
  267.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
                 ^
  268.           return (-2);
  269.       }

crypto/bio/bio_lib.c:268:9: 
  266.       if (!b->init) {
  267.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
  268. >         return (-2);
  269.       }
  270.   

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

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

ssl/ssl_lib.c:3180:1: start of procedure SSL_get_certificate()
  3178.   }
  3179.   
  3180. > X509 *SSL_get_certificate(const SSL *s)
  3181.   {
  3182.       if (s->cert != NULL)

ssl/ssl_lib.c:3182:9: Taking false branch
  3180.   X509 *SSL_get_certificate(const SSL *s)
  3181.   {
  3182.       if (s->cert != NULL)
                  ^
  3183.           return (s->cert->key->x509);
  3184.       else

ssl/ssl_lib.c:3185:9: 
  3183.           return (s->cert->key->x509);
  3184.       else
  3185. >         return (NULL);
  3186.   }
  3187.   

ssl/ssl_lib.c:3186:1: return from a call to SSL_get_certificate
  3184.       else
  3185.           return (NULL);
  3186. > }
  3187.   
  3188.   EVP_PKEY *SSL_get_privatekey(const SSL *s)

apps/s_server.c:641:5: 
639.       /* Build up OCSP query from server certificate */
640.       x = SSL_get_certificate(s);
641. >     aia = X509_get1_ocsp(x);
642.       if (aia) {
643.           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.   
