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


apps/s_server.c:522:1: start of procedure cert_status_cb()
520.    */
521.   
522. > static int cert_status_cb(SSL *s, void *arg)
523.   {
524.       tlsextstatusctx *srctx = arg;

apps/s_server.c:524:5: 
522.   static int cert_status_cb(SSL *s, void *arg)
523.   {
524. >     tlsextstatusctx *srctx = arg;
525.       char *host = NULL, *port = NULL, *path = NULL;
526.       int use_ssl;

apps/s_server.c:525:5: 
523.   {
524.       tlsextstatusctx *srctx = arg;
525. >     char *host = NULL, *port = NULL, *path = NULL;
526.       int use_ssl;
527.       unsigned char *rspder = NULL;

apps/s_server.c:527:5: 
525.       char *host = NULL, *port = NULL, *path = NULL;
526.       int use_ssl;
527. >     unsigned char *rspder = NULL;
528.       int rspderlen;
529.       STACK_OF(OPENSSL_STRING) *aia = NULL;

apps/s_server.c:529:5: 
527.       unsigned char *rspder = NULL;
528.       int rspderlen;
529. >     STACK_OF(OPENSSL_STRING) *aia = NULL;
530.       X509 *x = NULL;
531.       X509_STORE_CTX *inctx = NULL;

apps/s_server.c:530:5: 
528.       int rspderlen;
529.       STACK_OF(OPENSSL_STRING) *aia = NULL;
530. >     X509 *x = NULL;
531.       X509_STORE_CTX *inctx = NULL;
532.       X509_OBJECT *obj;

apps/s_server.c:531:5: 
529.       STACK_OF(OPENSSL_STRING) *aia = NULL;
530.       X509 *x = NULL;
531. >     X509_STORE_CTX *inctx = NULL;
532.       X509_OBJECT *obj;
533.       OCSP_REQUEST *req = NULL;

apps/s_server.c:533:5: 
531.       X509_STORE_CTX *inctx = NULL;
532.       X509_OBJECT *obj;
533. >     OCSP_REQUEST *req = NULL;
534.       OCSP_RESPONSE *resp = NULL;
535.       OCSP_CERTID *id = NULL;

apps/s_server.c:534:5: 
532.       X509_OBJECT *obj;
533.       OCSP_REQUEST *req = NULL;
534. >     OCSP_RESPONSE *resp = NULL;
535.       OCSP_CERTID *id = NULL;
536.       STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:535:5: 
533.       OCSP_REQUEST *req = NULL;
534.       OCSP_RESPONSE *resp = NULL;
535. >     OCSP_CERTID *id = NULL;
536.       STACK_OF(X509_EXTENSION) *exts;
537.       int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:537:5: 
535.       OCSP_CERTID *id = NULL;
536.       STACK_OF(X509_EXTENSION) *exts;
537. >     int ret = SSL_TLSEXT_ERR_NOACK;
538.       int i;
539.   

apps/s_server.c:540:9: Taking true branch
538.       int i;
539.   
540.       if (srctx->verbose)
               ^
541.           BIO_puts(bio_err, "cert_status: callback called\n");
542.       /* Build up OCSP query from server certificate */

apps/s_server.c:541:9: 
539.   
540.       if (srctx->verbose)
541. >         BIO_puts(bio_err, "cert_status: callback called\n");
542.       /* Build up OCSP query from server certificate */
543.       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:543:5: 
541.           BIO_puts(bio_err, "cert_status: callback called\n");
542.       /* Build up OCSP query from server certificate */
543. >     x = SSL_get_certificate(s);
544.       aia = X509_get1_ocsp(x);
545.       if (aia) {

ssl/ssl_lib.c:3166:1: start of procedure SSL_get_certificate()
  3164.   }
  3165.   
  3166. > X509 *SSL_get_certificate(const SSL *s)
  3167.   {
  3168.       if (s->cert != NULL)

ssl/ssl_lib.c:3168:9: Taking false branch
  3166.   X509 *SSL_get_certificate(const SSL *s)
  3167.   {
  3168.       if (s->cert != NULL)
                  ^
  3169.           return (s->cert->key->x509);
  3170.       else

ssl/ssl_lib.c:3171:9: 
  3169.           return (s->cert->key->x509);
  3170.       else
  3171. >         return (NULL);
  3172.   }
  3173.   

ssl/ssl_lib.c:3172:1: return from a call to SSL_get_certificate
  3170.       else
  3171.           return (NULL);
  3172. > }
  3173.   
  3174.   EVP_PKEY *SSL_get_privatekey(const SSL *s)

apps/s_server.c:544:5: 
542.       /* Build up OCSP query from server certificate */
543.       x = SSL_get_certificate(s);
544. >     aia = X509_get1_ocsp(x);
545.       if (aia) {
546.           if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0),

crypto/x509v3/v3_utl.c:385:1: start of procedure X509_get1_ocsp()
  383.   }
  384.   
  385. > STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x)
  386.   {
  387.       AUTHORITY_INFO_ACCESS *info;

crypto/x509v3/v3_utl.c:388:5: 
  386.   {
  387.       AUTHORITY_INFO_ACCESS *info;
  388. >     STACK_OF(OPENSSL_STRING) *ret = NULL;
  389.       int i;
  390.   

crypto/x509v3/v3_utl.c:391:5: 
  389.       int i;
  390.   
  391. >     info = X509_get_ext_d2i(x, NID_info_access, NULL, NULL);
  392.       if (!info)
  393.           return NULL;

crypto/x509/x509_ext.c:102:1: start of procedure X509_get_ext_d2i()
    100.   }
    101.   
    102. > void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx)
    103.   {
    104.       return X509V3_get_d2i(x->cert_info.extensions, nid, crit, idx);

crypto/x509/x509_ext.c:104:5: 
    102.   void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx)
    103.   {
    104. >     return X509V3_get_d2i(x->cert_info.extensions, nid, crit, idx);
    105.   }
    106.   
