crypto/x509v3/v3_cpols.c:189: error: NULL_DEREFERENCE
  pointer `pol` last assigned on line 188 could be null and is dereferenced at line 189, column 13.
Showing all 41 steps of the trace


crypto/x509v3/v3_cpols.c:135:1: start of procedure r2i_certpol()
133.   IMPLEMENT_ASN1_FUNCTIONS(NOTICEREF)
134.   
135. > static STACK_OF(POLICYINFO) *r2i_certpol(X509V3_EXT_METHOD *method,
136.                                            X509V3_CTX *ctx, char *value)
137.   {

crypto/x509v3/v3_cpols.c:138:5: 
136.                                            X509V3_CTX *ctx, char *value)
137.   {
138. >     STACK_OF(POLICYINFO) *pols = NULL;
139.       char *pstr;
140.       POLICYINFO *pol;

crypto/x509v3/v3_cpols.c:145:5: 
143.       CONF_VALUE *cnf;
144.       int i, ia5org;
145. >     pols = sk_POLICYINFO_new_null();
146.       if (pols == NULL) {
147.           X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_MALLOC_FAILURE);

crypto/stack/stack.c:145:1: start of procedure sk_new_null()
  143.   }
  144.   
  145. > _STACK *sk_new_null(void)
  146.   {
  147.       return sk_new((int (*)(const void *, const void *))0);

crypto/stack/stack.c:147:5: Skipping sk_new(): empty list of specs
  145.   _STACK *sk_new_null(void)
  146.   {
  147.       return sk_new((int (*)(const void *, const void *))0);
             ^
  148.   }
  149.   

crypto/stack/stack.c:148:1: return from a call to sk_new_null
  146.   {
  147.       return sk_new((int (*)(const void *, const void *))0);
  148. > }
  149.   
  150.   _STACK *sk_new(int (*c) (const void *, const void *))

crypto/x509v3/v3_cpols.c:146:9: Taking false branch
144.       int i, ia5org;
145.       pols = sk_POLICYINFO_new_null();
146.       if (pols == NULL) {
               ^
147.           X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_MALLOC_FAILURE);
148.           return NULL;

crypto/x509v3/v3_cpols.c:150:5: Skipping X509V3_parse_list(): empty list of specs
148.           return NULL;
149.       }
150.       vals = X509V3_parse_list(value);
           ^
151.       if (vals == NULL) {
152.           X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_X509V3_LIB);

crypto/x509v3/v3_cpols.c:151:9: Taking false branch
149.       }
150.       vals = X509V3_parse_list(value);
151.       if (vals == NULL) {
               ^
152.           X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_X509V3_LIB);
153.           goto err;

crypto/x509v3/v3_cpols.c:155:5: 
153.           goto err;
154.       }
155. >     ia5org = 0;
156.       for (i = 0; i < sk_CONF_VALUE_num(vals); i++) {
157.           cnf = sk_CONF_VALUE_value(vals, i);

crypto/x509v3/v3_cpols.c:156:10: 
154.       }
155.       ia5org = 0;
156. >     for (i = 0; i < sk_CONF_VALUE_num(vals); i++) {
157.           cnf = sk_CONF_VALUE_value(vals, i);
158.           if (cnf->value || !cnf->name) {

crypto/x509v3/v3_cpols.c:156:21: Condition is true
154.       }
155.       ia5org = 0;
156.       for (i = 0; i < sk_CONF_VALUE_num(vals); i++) {
                           ^
157.           cnf = sk_CONF_VALUE_value(vals, i);
158.           if (cnf->value || !cnf->name) {

crypto/x509v3/v3_cpols.c:156:17: 
154.       }
155.       ia5org = 0;
156. >     for (i = 0; i < sk_CONF_VALUE_num(vals); i++) {
157.           cnf = sk_CONF_VALUE_value(vals, i);
158.           if (cnf->value || !cnf->name) {

crypto/stack/stack.c:321:1: start of procedure sk_num()
  319.   }
  320.   
  321. > int sk_num(const _STACK *st)
  322.   {
  323.       if (st == NULL)

crypto/stack/stack.c:323:9: Taking false branch
  321.   int sk_num(const _STACK *st)
  322.   {
  323.       if (st == NULL)
                 ^
  324.           return -1;
  325.       return st->num;

crypto/stack/stack.c:325:5: 
  323.       if (st == NULL)
  324.           return -1;
  325. >     return st->num;
  326.   }
  327.   

crypto/stack/stack.c:326:1: return from a call to sk_num
  324.           return -1;
  325.       return st->num;
  326. > }
  327.   
  328.   void *sk_value(const _STACK *st, int i)

crypto/x509v3/v3_cpols.c:156:17: Loop condition is true. Entering loop body
154.       }
155.       ia5org = 0;
156.       for (i = 0; i < sk_CONF_VALUE_num(vals); i++) {
                       ^
157.           cnf = sk_CONF_VALUE_value(vals, i);
158.           if (cnf->value || !cnf->name) {

crypto/x509v3/v3_cpols.c:157:15: Condition is true
155.       ia5org = 0;
156.       for (i = 0; i < sk_CONF_VALUE_num(vals); i++) {
157.           cnf = sk_CONF_VALUE_value(vals, i);
                     ^
158.           if (cnf->value || !cnf->name) {
159.               X509V3err(X509V3_F_R2I_CERTPOL,

crypto/x509v3/v3_cpols.c:157:9: 
155.       ia5org = 0;
156.       for (i = 0; i < sk_CONF_VALUE_num(vals); i++) {
157. >         cnf = sk_CONF_VALUE_value(vals, i);
158.           if (cnf->value || !cnf->name) {
159.               X509V3err(X509V3_F_R2I_CERTPOL,

crypto/stack/stack.c:328:1: start of procedure sk_value()
  326.   }
  327.   
  328. > void *sk_value(const _STACK *st, int i)
  329.   {
  330.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:330:10: Taking false branch
  328.   void *sk_value(const _STACK *st, int i)
  329.   {
  330.       if (!st || (i < 0) || (i >= st->num))
                  ^
  331.           return NULL;
  332.       return st->data[i];

crypto/stack/stack.c:330:17: Taking false branch
  328.   void *sk_value(const _STACK *st, int i)
  329.   {
  330.       if (!st || (i < 0) || (i >= st->num))
                         ^
  331.           return NULL;
  332.       return st->data[i];

crypto/stack/stack.c:330:28: Taking false branch
  328.   void *sk_value(const _STACK *st, int i)
  329.   {
  330.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  331.           return NULL;
  332.       return st->data[i];

crypto/stack/stack.c:332:5: 
  330.       if (!st || (i < 0) || (i >= st->num))
  331.           return NULL;
  332. >     return st->data[i];
  333.   }
  334.   

crypto/stack/stack.c:333:1: return from a call to sk_value
  331.           return NULL;
  332.       return st->data[i];
  333. > }
  334.   
  335.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509v3/v3_cpols.c:158:13: Taking false branch
156.       for (i = 0; i < sk_CONF_VALUE_num(vals); i++) {
157.           cnf = sk_CONF_VALUE_value(vals, i);
158.           if (cnf->value || !cnf->name) {
                   ^
159.               X509V3err(X509V3_F_R2I_CERTPOL,
160.                         X509V3_R_INVALID_POLICY_IDENTIFIER);

crypto/x509v3/v3_cpols.c:158:28: Taking false branch
156.       for (i = 0; i < sk_CONF_VALUE_num(vals); i++) {
157.           cnf = sk_CONF_VALUE_value(vals, i);
158.           if (cnf->value || !cnf->name) {
                                  ^
159.               X509V3err(X509V3_F_R2I_CERTPOL,
160.                         X509V3_R_INVALID_POLICY_IDENTIFIER);

crypto/x509v3/v3_cpols.c:164:9: 
162.               goto err;
163.           }
164. >         pstr = cnf->name;
165.           if (strcmp(pstr, "ia5org") == 0) {
166.               ia5org = 1;

crypto/x509v3/v3_cpols.c:165:13: Taking false branch
163.           }
164.           pstr = cnf->name;
165.           if (strcmp(pstr, "ia5org") == 0) {
                   ^
166.               ia5org = 1;
167.               continue;

crypto/x509v3/v3_cpols.c:168:20: Taking false branch
166.               ia5org = 1;
167.               continue;
168.           } else if (*pstr == '@') {
                          ^
169.               STACK_OF(CONF_VALUE) *polsect;
170.               polsect = X509V3_get_section(ctx, pstr + 1);

crypto/x509v3/v3_cpols.c:182:17: Taking false branch
180.                   goto err;
181.           } else {
182.               if ((pobj = OBJ_txt2obj(cnf->name, 0)) == NULL) {
                       ^
183.                   X509V3err(X509V3_F_R2I_CERTPOL,
184.                             X509V3_R_INVALID_OBJECT_IDENTIFIER);

crypto/x509v3/v3_cpols.c:188:13: 
186.                   goto err;
187.               }
188. >             pol = POLICYINFO_new();
189.               pol->policyid = pobj;
190.           }

crypto/x509v3/v3_cpols.c:105:1: start of procedure POLICYINFO_new()
  103.   } ASN1_SEQUENCE_END(POLICYINFO)
  104.   
  105. > IMPLEMENT_ASN1_FUNCTIONS(POLICYINFO)
  106.   
  107.   ASN1_ADB_TEMPLATE(policydefault) = ASN1_SIMPLE(POLICYQUALINFO, d.other, ASN1_ANY);

crypto/asn1/tasn_new.c:74:1: start of procedure ASN1_item_new()
    72.   static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
    73.   
    74. > ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
    75.   {
    76.       ASN1_VALUE *ret = NULL;

crypto/asn1/tasn_new.c:76:5: 
    74.   ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
    75.   {
    76. >     ASN1_VALUE *ret = NULL;
    77.       if (ASN1_item_ex_new(&ret, it) > 0)
    78.           return ret;

crypto/asn1/tasn_new.c:77:9: Taking false branch
    75.   {
    76.       ASN1_VALUE *ret = NULL;
    77.       if (ASN1_item_ex_new(&ret, it) > 0)
                  ^
    78.           return ret;
    79.       return NULL;

crypto/asn1/tasn_new.c:79:5: 
    77.       if (ASN1_item_ex_new(&ret, it) > 0)
    78.           return ret;
    79. >     return NULL;
    80.   }
    81.   

crypto/asn1/tasn_new.c:80:1: return from a call to ASN1_item_new
    78.           return ret;
    79.       return NULL;
    80. > }
    81.   
    82.   /* Allocate an ASN1 structure */

crypto/x509v3/v3_cpols.c:105:1: return from a call to POLICYINFO_new
  103.   } ASN1_SEQUENCE_END(POLICYINFO)
  104.   
  105. > IMPLEMENT_ASN1_FUNCTIONS(POLICYINFO)
  106.   
  107.   ASN1_ADB_TEMPLATE(policydefault) = ASN1_SIMPLE(POLICYQUALINFO, d.other, ASN1_ANY);

crypto/x509v3/v3_cpols.c:189:13: 
187.               }
188.               pol = POLICYINFO_new();
189. >             pol->policyid = pobj;
190.           }
191.           if (!sk_POLICYINFO_push(pols, pol)) {

static STACK_OF(POLICYINFO) *r2i_certpol(X509V3_EXT_METHOD *method,
                                         X509V3_CTX *ctx, char *value)
{
    STACK_OF(POLICYINFO) *pols = NULL;
    char *pstr;
    POLICYINFO *pol;
    ASN1_OBJECT *pobj;
    STACK_OF(CONF_VALUE) *vals;
    CONF_VALUE *cnf;
    int i, ia5org;
    pols = sk_POLICYINFO_new_null();
    if (pols == NULL) {
        X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_MALLOC_FAILURE);
        return NULL;
    }
    vals = X509V3_parse_list(value);
    if (vals == NULL) {
        X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_X509V3_LIB);
        goto err;
    }
    ia5org = 0;
    for (i = 0; i < sk_CONF_VALUE_num(vals); i++) {
        cnf = sk_CONF_VALUE_value(vals, i);
        if (cnf->value || !cnf->name) {
            X509V3err(X509V3_F_R2I_CERTPOL,
                      X509V3_R_INVALID_POLICY_IDENTIFIER);
            X509V3_conf_err(cnf);
            goto err;
        }
        pstr = cnf->name;
        if (strcmp(pstr, "ia5org") == 0) {
            ia5org = 1;
            continue;
        } else if (*pstr == '@') {
            STACK_OF(CONF_VALUE) *polsect;
            polsect = X509V3_get_section(ctx, pstr + 1);
            if (!polsect) {
                X509V3err(X509V3_F_R2I_CERTPOL, X509V3_R_INVALID_SECTION);
                X509V3_conf_err(cnf);
                goto err;
            }
            pol = policy_section(ctx, polsect, ia5org);
            X509V3_section_free(ctx, polsect);
            if (pol == NULL)
                goto err;
        } else {
            if ((pobj = OBJ_txt2obj(cnf->name, 0)) == NULL) {
                X509V3err(X509V3_F_R2I_CERTPOL,
                          X509V3_R_INVALID_OBJECT_IDENTIFIER);
                X509V3_conf_err(cnf);
                goto err;
            }
            pol = POLICYINFO_new();
            pol->policyid = pobj;
        }
        if (!sk_POLICYINFO_push(pols, pol)) {
            POLICYINFO_free(pol);
            X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_MALLOC_FAILURE);
            goto err;
        }
    }
    sk_CONF_VALUE_pop_free(vals, X509V3_conf_free);
    return pols;
 err:
    sk_CONF_VALUE_pop_free(vals, X509V3_conf_free);
    sk_POLICYINFO_pop_free(pols, POLICYINFO_free);
    return NULL;
}
['static STACK_OF(POLICYINFO) *r2i_certpol(X509V3_EXT_METHOD *method,\n                                         X509V3_CTX *ctx, char *value)\n{\n    STACK_OF(POLICYINFO) *pols = NULL;\n    char *pstr;\n    POLICYINFO *pol;\n    ASN1_OBJECT *pobj;\n    STACK_OF(CONF_VALUE) *vals;\n    CONF_VALUE *cnf;\n    int i, ia5org;\n    pols = sk_POLICYINFO_new_null();\n    if (pols == NULL) {\n        X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_MALLOC_FAILURE);\n        return NULL;\n    }\n    vals = X509V3_parse_list(value);\n    if (vals == NULL) {\n        X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_X509V3_LIB);\n        goto err;\n    }\n    ia5org = 0;\n    for (i = 0; i < sk_CONF_VALUE_num(vals); i++) {\n        cnf = sk_CONF_VALUE_value(vals, i);\n        if (cnf->value || !cnf->name) {\n            X509V3err(X509V3_F_R2I_CERTPOL,\n                      X509V3_R_INVALID_POLICY_IDENTIFIER);\n            X509V3_conf_err(cnf);\n            goto err;\n        }\n        pstr = cnf->name;\n        if (strcmp(pstr, "ia5org") == 0) {\n            ia5org = 1;\n            continue;\n        } else if (*pstr == \'@\') {\n            STACK_OF(CONF_VALUE) *polsect;\n            polsect = X509V3_get_section(ctx, pstr + 1);\n            if (!polsect) {\n                X509V3err(X509V3_F_R2I_CERTPOL, X509V3_R_INVALID_SECTION);\n                X509V3_conf_err(cnf);\n                goto err;\n            }\n            pol = policy_section(ctx, polsect, ia5org);\n            X509V3_section_free(ctx, polsect);\n            if (pol == NULL)\n                goto err;\n        } else {\n            if ((pobj = OBJ_txt2obj(cnf->name, 0)) == NULL) {\n                X509V3err(X509V3_F_R2I_CERTPOL,\n                          X509V3_R_INVALID_OBJECT_IDENTIFIER);\n                X509V3_conf_err(cnf);\n                goto err;\n            }\n            pol = POLICYINFO_new();\n            pol->policyid = pobj;\n        }\n        if (!sk_POLICYINFO_push(pols, pol)) {\n            POLICYINFO_free(pol);\n            X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_MALLOC_FAILURE);\n            goto err;\n        }\n    }\n    sk_CONF_VALUE_pop_free(vals, X509V3_conf_free);\n    return pols;\n err:\n    sk_CONF_VALUE_pop_free(vals, X509V3_conf_free);\n    sk_POLICYINFO_pop_free(pols, POLICYINFO_free);\n    return NULL;\n}', '_STACK *sk_new_null(void)\n{\n    return sk_new((int (*)(const void *, const void *))0);\n}', 'int sk_num(const _STACK *st)\n{\n    if (st == NULL)\n        return -1;\n    return st->num;\n}', 'void *sk_value(const _STACK *st, int i)\n{\n    if (!st || (i < 0) || (i >= st->num))\n        return NULL;\n    return st->data[i];\n}', 'IMPLEMENT_ASN1_FUNCTIONS(POLICYINFO)', 'ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)\n{\n    ASN1_VALUE *ret = NULL;\n    if (ASN1_item_ex_new(&ret, it) > 0)\n        return ret;\n    return NULL;\n}']