crypto/x509/x509name.c:88: error: NULL_DEREFERENCE
  pointer `data` last assigned on line 87 could be null and is dereferenced at line 88, column 10.
Showing all 27 steps of the trace


crypto/x509/x509name.c:78:1: start of procedure X509_NAME_get_text_by_OBJ()
76.   }
77.   
78. > int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, char *buf,
79.                                 int len)
80.   {

crypto/x509/x509name.c:84:5: Skipping X509_NAME_get_index_by_OBJ(): empty list of specs
82.       ASN1_STRING *data;
83.   
84.       i = X509_NAME_get_index_by_OBJ(name, obj, -1);
          ^
85.       if (i < 0)
86.           return (-1);

crypto/x509/x509name.c:85:9: Taking false branch
83.   
84.       i = X509_NAME_get_index_by_OBJ(name, obj, -1);
85.       if (i < 0)
              ^
86.           return (-1);
87.       data = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name, i));

crypto/x509/x509name.c:87:5: 
85.       if (i < 0)
86.           return (-1);
87. >     data = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name, i));
88.       i = (data->length > (len - 1)) ? (len - 1) : data->length;
89.       if (buf == NULL)

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:327:1: start of procedure sk_num()
    325.   }
    326.   
    327. > int sk_num(const _STACK *st)
    328.   {
    329.       if (st == NULL)

crypto/stack/stack.c:329:9: Taking false branch
    327.   int sk_num(const _STACK *st)
    328.   {
    329.       if (st == NULL)
                   ^
    330.           return -1;
    331.       return st->num;

crypto/stack/stack.c:331:5: 
    329.       if (st == NULL)
    330.           return -1;
    331. >     return st->num;
    332.   }
    333.   

crypto/stack/stack.c:332:1: return from a call to sk_num
    330.           return -1;
    331.       return st->num;
    332. > }
    333.   
    334.   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:334:1: start of procedure sk_value()
    332.   }
    333.   
    334. > void *sk_value(const _STACK *st, int i)
    335.   {
    336.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:336:10: Taking false branch
    334.   void *sk_value(const _STACK *st, int i)
    335.   {
    336.       if (!st || (i < 0) || (i >= st->num))
                    ^
    337.           return NULL;
    338.       return st->data[i];

crypto/stack/stack.c:336:17: Taking false branch
    334.   void *sk_value(const _STACK *st, int i)
    335.   {
    336.       if (!st || (i < 0) || (i >= st->num))
                           ^
    337.           return NULL;
    338.       return st->data[i];

crypto/stack/stack.c:336:28: Taking false branch
    334.   void *sk_value(const _STACK *st, int i)
    335.   {
    336.       if (!st || (i < 0) || (i >= st->num))
                                      ^
    337.           return NULL;
    338.       return st->data[i];

crypto/stack/stack.c:338:5: 
    336.       if (!st || (i < 0) || (i >= st->num))
    337.           return NULL;
    338. >     return st->data[i];
    339.   }
    340.   

crypto/stack/stack.c:339:1: return from a call to sk_value
    337.           return NULL;
    338.       return st->data[i];
    339. > }
    340.   
    341.   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)

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

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

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

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

crypto/x509/x509name.c:88:10: 
86.           return (-1);
87.       data = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name, i));
88. >     i = (data->length > (len - 1)) ? (len - 1) : data->length;
89.       if (buf == NULL)
90.           return (data->length);

int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, char *buf,
                              int len)
{
    int i;
    ASN1_STRING *data;
    i = X509_NAME_get_index_by_OBJ(name, obj, -1);
    if (i < 0)
        return (-1);
    data = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name, i));
    i = (data->length > (len - 1)) ? (len - 1) : data->length;
    if (buf == NULL)
        return (data->length);
    memcpy(buf, data->data, i);
    buf[i] = '\0';
    return (i);
}
["int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, char *buf,\n                              int len)\n{\n    int i;\n    ASN1_STRING *data;\n    i = X509_NAME_get_index_by_OBJ(name, obj, -1);\n    if (i < 0)\n        return (-1);\n    data = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name, i));\n    i = (data->length > (len - 1)) ? (len - 1) : data->length;\n    if (buf == NULL)\n        return (data->length);\n    memcpy(buf, data->data, i);\n    buf[i] = '\\0';\n    return (i);\n}", 'X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc)\n{\n    if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc\n        || loc < 0)\n        return (NULL);\n    else\n        return (sk_X509_NAME_ENTRY_value(name->entries, loc));\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}', 'ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne)\n{\n    if (ne == NULL)\n        return (NULL);\n    return (ne->value);\n}']