apps/ca.c:1500: error: NULL_DEREFERENCE
  pointer `str` last assigned on line 1493 could be null and is dereferenced at line 1500, column 17.
Showing all 73 steps of the trace


apps/ca.c:1440:1: start of procedure do_body()
1438.   }
1439.   
1440. > static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
1441.                      const EVP_MD *dgst, STACK_OF(OPENSSL_STRING) *sigopts,
1442.                      STACK_OF(CONF_VALUE) *policy, CA_DB *db, BIGNUM *serial,

apps/ca.c:1449:5: 
1447.                      int default_op, int ext_copy, int selfsign)
1448.   {
1449. >     X509_NAME *name = NULL, *CAname = NULL, *subject = NULL, *dn_subject =
1450.           NULL;
1451.       ASN1_UTCTIME *tm, *tmptm;

apps/ca.c:1454:5: 
1452.       ASN1_STRING *str, *str2;
1453.       ASN1_OBJECT *obj;
1454. >     X509 *ret = NULL;
1455.       X509_NAME_ENTRY *ne;
1456.       X509_NAME_ENTRY *tne, *push;

apps/ca.c:1458:5: 
1456.       X509_NAME_ENTRY *tne, *push;
1457.       EVP_PKEY *pktmp;
1458. >     int ok = -1, i, j, last, nid;
1459.       const char *p;
1460.       CONF_VALUE *cv;

apps/ca.c:1462:5: 
1460.       CONF_VALUE *cv;
1461.       OPENSSL_STRING row[DB_NUMBER];
1462. >     OPENSSL_STRING *irow = NULL;
1463.       OPENSSL_STRING *rrow = NULL;
1464.       char buf[25];

apps/ca.c:1463:5: 
1461.       OPENSSL_STRING row[DB_NUMBER];
1462.       OPENSSL_STRING *irow = NULL;
1463. >     OPENSSL_STRING *rrow = NULL;
1464.       char buf[25];
1465.   

apps/ca.c:1466:5: 
1464.       char buf[25];
1465.   
1466. >     tmptm = ASN1_UTCTIME_new();
1467.       if (tmptm == NULL) {
1468.           BIO_printf(bio_err, "malloc error\n");

crypto/asn1/tasn_typ.c:86:1: start of procedure ASN1_UTCTIME_new()
  84.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_IA5STRING)
  85.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING)
  86. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME)
  87.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME)
  88.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING)

crypto/asn1/tasn_typ.c:86:1: return from a call to ASN1_UTCTIME_new
  84.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_IA5STRING)
  85.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING)
  86. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME)
  87.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME)
  88.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING)

apps/ca.c:1467:9: Taking false branch
1465.   
1466.       tmptm = ASN1_UTCTIME_new();
1467.       if (tmptm == NULL) {
                ^
1468.           BIO_printf(bio_err, "malloc error\n");
1469.           return (0);

apps/ca.c:1472:10: 
1470.       }
1471.   
1472. >     for (i = 0; i < DB_NUMBER; i++)
1473.           row[i] = NULL;
1474.   

apps/ca.c:1472:17: Loop condition is true. Entering loop body
1470.       }
1471.   
1472.       for (i = 0; i < DB_NUMBER; i++)
                        ^
1473.           row[i] = NULL;
1474.   

apps/ca.c:1473:9: 
1471.   
1472.       for (i = 0; i < DB_NUMBER; i++)
1473. >         row[i] = NULL;
1474.   
1475.       if (subj) {

apps/ca.c:1472:32: 
1470.       }
1471.   
1472. >     for (i = 0; i < DB_NUMBER; i++)
1473.           row[i] = NULL;
1474.   

apps/ca.c:1472:17: Loop condition is false. Leaving loop
1470.       }
1471.   
1472.       for (i = 0; i < DB_NUMBER; i++)
                        ^
1473.           row[i] = NULL;
1474.   

apps/ca.c:1475:9: Taking false branch
1473.           row[i] = NULL;
1474.   
1475.       if (subj) {
                ^
1476.           X509_NAME *n = parse_name(subj, chtype, multirdn);
1477.   

apps/ca.c:1486:9: Taking false branch
1484.       }
1485.   
1486.       if (default_op)
                ^
1487.           BIO_printf(bio_err,
1488.                      "The Subject's Distinguished Name is as follows\n");

apps/ca.c:1490:5: 
1488.                      "The Subject's Distinguished Name is as follows\n");
1489.   
1490. >     name = X509_REQ_get_subject_name(req);
1491.       for (i = 0; i < X509_NAME_entry_count(name); i++) {
1492.           ne = X509_NAME_get_entry(name, i);

crypto/x509/x509_req.c:313:1: start of procedure X509_REQ_get_subject_name()
  311.   }
  312.   
  313. > X509_NAME *X509_REQ_get_subject_name(X509_REQ *req)
  314.   {
  315.       return req->req_info.subject;

crypto/x509/x509_req.c:315:5: 
  313.   X509_NAME *X509_REQ_get_subject_name(X509_REQ *req)
  314.   {
  315. >     return req->req_info.subject;
  316.   }

crypto/x509/x509_req.c:316:1: return from a call to X509_REQ_get_subject_name
  314.   {
  315.       return req->req_info.subject;
  316. > }

apps/ca.c:1491:10: 
1489.   
1490.       name = X509_REQ_get_subject_name(req);
1491. >     for (i = 0; i < X509_NAME_entry_count(name); i++) {
1492.           ne = X509_NAME_get_entry(name, i);
1493.           str = X509_NAME_ENTRY_get_data(ne);

apps/ca.c:1491:17: 
1489.   
1490.       name = X509_REQ_get_subject_name(req);
1491. >     for (i = 0; i < X509_NAME_entry_count(name); i++) {
1492.           ne = X509_NAME_get_entry(name, i);
1493.           str = X509_NAME_ENTRY_get_data(ne);

crypto/x509/x509name.c:96:1: start of procedure X509_NAME_entry_count()
  94.   }
  95.   
  96. > int X509_NAME_entry_count(X509_NAME *name)
  97.   {
  98.       if (name == NULL)

crypto/x509/x509name.c:98:9: Taking false branch
  96.   int X509_NAME_entry_count(X509_NAME *name)
  97.   {
  98.       if (name == NULL)
                 ^
  99.           return (0);
  100.       return (sk_X509_NAME_ENTRY_num(name->entries));

crypto/x509/x509name.c:100:13: Condition is true
  98.       if (name == NULL)
  99.           return (0);
  100.       return (sk_X509_NAME_ENTRY_num(name->entries));
                     ^
  101.   }
  102.   

crypto/x509/x509name.c:100:5: 
  98.       if (name == NULL)
  99.           return (0);
  100. >     return (sk_X509_NAME_ENTRY_num(name->entries));
  101.   }
  102.   

crypto/stack/stack.c:317:1: start of procedure sk_num()
    315.   }
    316.   
    317. > int sk_num(const _STACK *st)
    318.   {
    319.       if (st == NULL)

crypto/stack/stack.c:319:9: Taking false branch
    317.   int sk_num(const _STACK *st)
    318.   {
    319.       if (st == NULL)
                   ^
    320.           return -1;
    321.       return st->num;

crypto/stack/stack.c:321:5: 
    319.       if (st == NULL)
    320.           return -1;
    321. >     return st->num;
    322.   }
    323.   

crypto/stack/stack.c:322:1: return from a call to sk_num
    320.           return -1;
    321.       return st->num;
    322. > }
    323.   
    324.   void *sk_value(const _STACK *st, int i)

crypto/x509/x509name.c:101:1: return from a call to X509_NAME_entry_count
  99.           return (0);
  100.       return (sk_X509_NAME_ENTRY_num(name->entries));
  101. > }
  102.   
  103.   int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos)

apps/ca.c:1491:17: Loop condition is true. Entering loop body
1489.   
1490.       name = X509_REQ_get_subject_name(req);
1491.       for (i = 0; i < X509_NAME_entry_count(name); i++) {
                        ^
1492.           ne = X509_NAME_get_entry(name, i);
1493.           str = X509_NAME_ENTRY_get_data(ne);

apps/ca.c:1492:9: 
1490.       name = X509_REQ_get_subject_name(req);
1491.       for (i = 0; i < X509_NAME_entry_count(name); i++) {
1492. >         ne = X509_NAME_get_entry(name, i);
1493.           str = X509_NAME_ENTRY_get_data(ne);
1494.           obj = X509_NAME_ENTRY_get_object(ne);

crypto/x509/x509name.c:134:1: start of procedure X509_NAME_get_entry()
  132.   }
  133.   
  134. > X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc)
  135.   {
  136.       if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc

crypto/x509/x509name.c:136:9: Taking false branch
  134.   X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc)
  135.   {
  136.       if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc
                 ^
  137.           || loc < 0)
  138.           return (NULL);

crypto/x509/x509name.c:136:25: Condition is true
  134.   X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc)
  135.   {
  136.       if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc
                                 ^
  137.           || loc < 0)
  138.           return (NULL);

crypto/stack/stack.c:317:1: start of procedure sk_num()
    315.   }
    316.   
    317. > int sk_num(const _STACK *st)
    318.   {
    319.       if (st == NULL)

crypto/stack/stack.c:319:9: Taking false branch
    317.   int sk_num(const _STACK *st)
    318.   {
    319.       if (st == NULL)
                   ^
    320.           return -1;
    321.       return st->num;

crypto/stack/stack.c:321:5: 
    319.       if (st == NULL)
    320.           return -1;
    321. >     return st->num;
    322.   }
    323.   

crypto/stack/stack.c:322:1: return from a call to sk_num
    320.           return -1;
    321.       return st->num;
    322. > }
    323.   
    324.   void *sk_value(const _STACK *st, int i)

crypto/x509/x509name.c:136:25: Taking false branch
  134.   X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc)
  135.   {
  136.       if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc
                                 ^
  137.           || loc < 0)
  138.           return (NULL);

crypto/x509/x509name.c:137:12: Taking false branch
  135.   {
  136.       if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc
  137.           || loc < 0)
                    ^
  138.           return (NULL);
  139.       else

crypto/x509/x509name.c:140:17: Condition is true
  138.           return (NULL);
  139.       else
  140.           return (sk_X509_NAME_ENTRY_value(name->entries, loc));
                         ^
  141.   }
  142.   

crypto/x509/x509name.c:140:9: 
  138.           return (NULL);
  139.       else
  140. >         return (sk_X509_NAME_ENTRY_value(name->entries, loc));
  141.   }
  142.   

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

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

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

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

crypto/stack/stack.c:328:5: 
    326.       if (!st || (i < 0) || (i >= st->num))
    327.           return NULL;
    328. >     return st->data[i];
    329.   }
    330.   

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

crypto/x509/x509name.c:141:1: return from a call to X509_NAME_get_entry
  139.       else
  140.           return (sk_X509_NAME_ENTRY_value(name->entries, loc));
  141. > }
  142.   
  143.   X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc)

apps/ca.c:1493:9: 
1491.       for (i = 0; i < X509_NAME_entry_count(name); i++) {
1492.           ne = X509_NAME_get_entry(name, i);
1493. >         str = X509_NAME_ENTRY_get_data(ne);
1494.           obj = X509_NAME_ENTRY_get_object(ne);
1495.   

crypto/x509/x509name.c:392:1: start of procedure X509_NAME_ENTRY_get_data()
  390.   }
  391.   
  392. > ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne)
  393.   {
  394.       if (ne == NULL)

crypto/x509/x509name.c:394:9: Taking true branch
  392.   ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne)
  393.   {
  394.       if (ne == NULL)
                 ^
  395.           return (NULL);
  396.       return (ne->value);

crypto/x509/x509name.c:395:9: 
  393.   {
  394.       if (ne == NULL)
  395. >         return (NULL);
  396.       return (ne->value);
  397.   }

crypto/x509/x509name.c:397:1: return from a call to X509_NAME_ENTRY_get_data
  395.           return (NULL);
  396.       return (ne->value);
  397. > }
  398.   
  399.   int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne)

apps/ca.c:1494:9: 
1492.           ne = X509_NAME_get_entry(name, i);
1493.           str = X509_NAME_ENTRY_get_data(ne);
1494. >         obj = X509_NAME_ENTRY_get_object(ne);
1495.   
1496.           if (msie_hack) {

crypto/x509/x509name.c:385:1: start of procedure X509_NAME_ENTRY_get_object()
  383.   }
  384.   
  385. > ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne)
  386.   {
  387.       if (ne == NULL)

crypto/x509/x509name.c:387:9: Taking true branch
  385.   ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne)
  386.   {
  387.       if (ne == NULL)
                 ^
  388.           return (NULL);
  389.       return (ne->object);

crypto/x509/x509name.c:388:9: 
  386.   {
  387.       if (ne == NULL)
  388. >         return (NULL);
  389.       return (ne->object);
  390.   }

crypto/x509/x509name.c:390:1: return from a call to X509_NAME_ENTRY_get_object
  388.           return (NULL);
  389.       return (ne->object);
  390. > }
  391.   
  392.   ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne)

apps/ca.c:1496:13: Taking true branch
1494.           obj = X509_NAME_ENTRY_get_object(ne);
1495.   
1496.           if (msie_hack) {
                    ^
1497.               /* assume all type should be strings */
1498.               nid = OBJ_obj2nid(X509_NAME_ENTRY_get_object(ne));

apps/ca.c:1498:13: 
1496.           if (msie_hack) {
1497.               /* assume all type should be strings */
1498. >             nid = OBJ_obj2nid(X509_NAME_ENTRY_get_object(ne));
1499.   
1500.               if (str->type == V_ASN1_UNIVERSALSTRING)

crypto/x509/x509name.c:385:1: start of procedure X509_NAME_ENTRY_get_object()
  383.   }
  384.   
  385. > ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne)
  386.   {
  387.       if (ne == NULL)

crypto/x509/x509name.c:387:9: Taking true branch
  385.   ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne)
  386.   {
  387.       if (ne == NULL)
                 ^
  388.           return (NULL);
  389.       return (ne->object);

crypto/x509/x509name.c:388:9: 
  386.   {
  387.       if (ne == NULL)
  388. >         return (NULL);
  389.       return (ne->object);
  390.   }

crypto/x509/x509name.c:390:1: return from a call to X509_NAME_ENTRY_get_object
  388.           return (NULL);
  389.       return (ne->object);
  390. > }
  391.   
  392.   ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne)

crypto/objects/obj_dat.c:390:1: start of procedure OBJ_obj2nid()
  388.   IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj);
  389.   
  390. > int OBJ_obj2nid(const ASN1_OBJECT *a)
  391.   {
  392.       const unsigned int *op;

crypto/objects/obj_dat.c:395:9: Taking true branch
  393.       ADDED_OBJ ad, *adp;
  394.   
  395.       if (a == NULL)
                 ^
  396.           return (NID_undef);
  397.       if (a->nid != 0)

crypto/objects/obj_dat.c:396:9: 
  394.   
  395.       if (a == NULL)
  396. >         return (NID_undef);
  397.       if (a->nid != 0)
  398.           return (a->nid);

crypto/objects/obj_dat.c:414:1: return from a call to OBJ_obj2nid
  412.           return (NID_undef);
  413.       return (nid_objs[*op].nid);
  414. > }
  415.   
  416.   /*

apps/ca.c:1500:17: 
1498.               nid = OBJ_obj2nid(X509_NAME_ENTRY_get_object(ne));
1499.   
1500. >             if (str->type == V_ASN1_UNIVERSALSTRING)
1501.                   ASN1_UNIVERSALSTRING_to_string(str);
1502.   
