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


apps/s_server.c:823:1: start of procedure cert_status_cb()
821.    */
822.   
823. > static int cert_status_cb(SSL *s, void *arg)
824.   {
825.       tlsextstatusctx *srctx = arg;

apps/s_server.c:825:5: 
823.   static int cert_status_cb(SSL *s, void *arg)
824.   {
825. >     tlsextstatusctx *srctx = arg;
826.       BIO *err = srctx->err;
827.       char *host, *port, *path;

apps/s_server.c:826:5: 
824.   {
825.       tlsextstatusctx *srctx = arg;
826. >     BIO *err = srctx->err;
827.       char *host, *port, *path;
828.       int use_ssl;

apps/s_server.c:829:5: 
827.       char *host, *port, *path;
828.       int use_ssl;
829. >     unsigned char *rspder = NULL;
830.       int rspderlen;
831.       STACK_OF(OPENSSL_STRING) *aia = NULL;

apps/s_server.c:831:5: 
829.       unsigned char *rspder = NULL;
830.       int rspderlen;
831. >     STACK_OF(OPENSSL_STRING) *aia = NULL;
832.       X509 *x = NULL;
833.       X509_STORE_CTX inctx;

apps/s_server.c:832:5: 
830.       int rspderlen;
831.       STACK_OF(OPENSSL_STRING) *aia = NULL;
832. >     X509 *x = NULL;
833.       X509_STORE_CTX inctx;
834.       X509_OBJECT obj;

apps/s_server.c:835:5: 
833.       X509_STORE_CTX inctx;
834.       X509_OBJECT obj;
835. >     OCSP_REQUEST *req = NULL;
836.       OCSP_RESPONSE *resp = NULL;
837.       OCSP_CERTID *id = NULL;

apps/s_server.c:836:5: 
834.       X509_OBJECT obj;
835.       OCSP_REQUEST *req = NULL;
836. >     OCSP_RESPONSE *resp = NULL;
837.       OCSP_CERTID *id = NULL;
838.       STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:837:5: 
835.       OCSP_REQUEST *req = NULL;
836.       OCSP_RESPONSE *resp = NULL;
837. >     OCSP_CERTID *id = NULL;
838.       STACK_OF(X509_EXTENSION) *exts;
839.       int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:839:5: 
837.       OCSP_CERTID *id = NULL;
838.       STACK_OF(X509_EXTENSION) *exts;
839. >     int ret = SSL_TLSEXT_ERR_NOACK;
840.       int i;
841.       if (srctx->verbose)

apps/s_server.c:841:9: Taking true branch
839.       int ret = SSL_TLSEXT_ERR_NOACK;
840.       int i;
841.       if (srctx->verbose)
               ^
842.           BIO_puts(err, "cert_status: callback called\n");
843.       /* Build up OCSP query from server certificate */

apps/s_server.c:842:9: 
840.       int i;
841.       if (srctx->verbose)
842. >         BIO_puts(err, "cert_status: callback called\n");
843.       /* Build up OCSP query from server certificate */
844.       x = SSL_get_certificate(s);

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

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

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

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

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

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

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

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

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

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

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

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

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

apps/s_server.c:844:5: 
842.           BIO_puts(err, "cert_status: callback called\n");
843.       /* Build up OCSP query from server certificate */
844. >     x = SSL_get_certificate(s);
845.       aia = X509_get1_ocsp(x);
846.       if (aia) {

ssl/ssl_lib.c:2937:1: start of procedure SSL_get_certificate()
  2935.   }
  2936.   
  2937. > X509 *SSL_get_certificate(const SSL *s)
  2938.   {
  2939.       if (s->cert != NULL)

ssl/ssl_lib.c:2939:9: Taking false branch
  2937.   X509 *SSL_get_certificate(const SSL *s)
  2938.   {
  2939.       if (s->cert != NULL)
                  ^
  2940.           return (s->cert->key->x509);
  2941.       else

ssl/ssl_lib.c:2942:9: 
  2940.           return (s->cert->key->x509);
  2941.       else
  2942. >         return (NULL);
  2943.   }
  2944.   

ssl/ssl_lib.c:2943:1: return from a call to SSL_get_certificate
  2941.       else
  2942.           return (NULL);
  2943. > }
  2944.   
  2945.   EVP_PKEY *SSL_get_privatekey(const SSL *s)

apps/s_server.c:845:5: 
843.       /* Build up OCSP query from server certificate */
844.       x = SSL_get_certificate(s);
845. >     aia = X509_get1_ocsp(x);
846.       if (aia) {
847.           if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0),
