ssl/t1_lib.c:2350: error: NULL_DEREFERENCE
  pointer `null` is dereferenced by call to `ssl_security_cert()` at line 2350, column 10.
Showing all 11 steps of the trace


ssl/t1_lib.c:2341:1: start of procedure ssl_security_cert_chain()
2339.    */
2340.   
2341. > int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy)
2342.   {
2343.       int rv, start_idx, i;

ssl/t1_lib.c:2344:9: Taking true branch
2342.   {
2343.       int rv, start_idx, i;
2344.       if (x == NULL) {
                ^
2345.           x = sk_X509_value(sk, 0);
2346.           start_idx = 1;

ssl/t1_lib.c:2345:9: 
2343.       int rv, start_idx, i;
2344.       if (x == NULL) {
2345. >         x = sk_X509_value(sk, 0);
2346.           start_idx = 1;
2347.       } else

include/openssl/x509.h:99:1: start of procedure sk_X509_value()
  97.   typedef struct x509_cinf_st X509_CINF;
  98.   
  99. > DEFINE_STACK_OF(X509)
  100.   
  101.   /* This is used for a table of trust checking functions */

crypto/stack/stack.c:381:1: start of procedure OPENSSL_sk_value()
    379.   }
    380.   
    381. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    382.   {
    383.       if (st == NULL || i < 0 || i >= st->num)

crypto/stack/stack.c:383:9: Taking true branch
    381.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    382.   {
    383.       if (st == NULL || i < 0 || i >= st->num)
                   ^
    384.           return NULL;
    385.       return (void *)st->data[i];

crypto/stack/stack.c:384:9: 
    382.   {
    383.       if (st == NULL || i < 0 || i >= st->num)
    384. >         return NULL;
    385.       return (void *)st->data[i];
    386.   }

crypto/stack/stack.c:386:1: return from a call to OPENSSL_sk_value
    384.           return NULL;
    385.       return (void *)st->data[i];
    386. > }
    387.   
    388.   void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data)

include/openssl/x509.h:99:1: return from a call to sk_X509_value
  97.   typedef struct x509_cinf_st X509_CINF;
  98.   
  99. > DEFINE_STACK_OF(X509)
  100.   
  101.   /* This is used for a table of trust checking functions */

ssl/t1_lib.c:2346:9: 
2344.       if (x == NULL) {
2345.           x = sk_X509_value(sk, 0);
2346. >         start_idx = 1;
2347.       } else
2348.           start_idx = 0;

ssl/t1_lib.c:2350:5: 
2348.           start_idx = 0;
2349.   
2350. >     rv = ssl_security_cert(s, NULL, x, vfy, 1);
2351.       if (rv != 1)
2352.           return rv;

int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy)
{
    int rv, start_idx, i;
    if (x == NULL) {
        x = sk_X509_value(sk, 0);
        start_idx = 1;
    } else
        start_idx = 0;
    rv = ssl_security_cert(s, NULL, x, vfy, 1);
    if (rv != 1)
        return rv;
    for (i = start_idx; i < sk_X509_num(sk); i++) {
        x = sk_X509_value(sk, i);
        rv = ssl_security_cert(s, NULL, x, vfy, 0);
        if (rv != 1)
            return rv;
    }
    return 1;
}
['int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy)\n{\n    int rv, start_idx, i;\n    if (x == NULL) {\n        x = sk_X509_value(sk, 0);\n        start_idx = 1;\n    } else\n        start_idx = 0;\n    rv = ssl_security_cert(s, NULL, x, vfy, 1);\n    if (rv != 1)\n        return rv;\n    for (i = start_idx; i < sk_X509_num(sk); i++) {\n        x = sk_X509_value(sk, i);\n        rv = ssl_security_cert(s, NULL, x, vfy, 0);\n        if (rv != 1)\n            return rv;\n    }\n    return 1;\n}', 'DEFINE_STACK_OF(X509)', 'void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)\n{\n    if (st == NULL || i < 0 || i >= st->num)\n        return NULL;\n    return (void *)st->data[i];\n}']