crypto/x509/x_name.c:296: error: NULL_DEREFERENCE
  pointer `entries` last assigned on line 280 could be null and is dereferenced by call to `sk_push()` at line 296, column 14.
Showing all 30 steps of the trace


crypto/x509/x_name.c:270:1: start of procedure x509_name_encode()
268.   }
269.   
270. > static int x509_name_encode(X509_NAME *a)
271.   {
272.       union {

crypto/x509/x_name.c:272:5: 
270.   static int x509_name_encode(X509_NAME *a)
271.   {
272. >     union {
273.           STACK_OF(STACK_OF_X509_NAME_ENTRY) *s;
274.           ASN1_VALUE *a;

crypto/x509/x_name.c:280:5: 
278.       int len;
279.       unsigned char *p;
280. >     STACK_OF(X509_NAME_ENTRY) *entries = NULL;
281.       X509_NAME_ENTRY *entry;
282.       int i, set = -1;

crypto/x509/x_name.c:282:5: 
280.       STACK_OF(X509_NAME_ENTRY) *entries = NULL;
281.       X509_NAME_ENTRY *entry;
282. >     int i, set = -1;
283.       intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
284.       if (!intname.s)

crypto/x509/x_name.c:283:5: 
281.       X509_NAME_ENTRY *entry;
282.       int i, set = -1;
283. >     intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
284.       if (!intname.s)
285.           goto memerr;

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/x509/x_name.c:284:10: Taking false branch
282.       int i, set = -1;
283.       intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
284.       if (!intname.s)
                ^
285.           goto memerr;
286.       for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {

crypto/x509/x_name.c:286:10: 
284.       if (!intname.s)
285.           goto memerr;
286. >     for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
287.           entry = sk_X509_NAME_ENTRY_value(a->entries, i);
288.           if (entry->set != set) {

crypto/x509/x_name.c:286:21: Condition is true
284.       if (!intname.s)
285.           goto memerr;
286.       for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
                           ^
287.           entry = sk_X509_NAME_ENTRY_value(a->entries, i);
288.           if (entry->set != set) {

crypto/x509/x_name.c:286:17: 
284.       if (!intname.s)
285.           goto memerr;
286. >     for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
287.           entry = sk_X509_NAME_ENTRY_value(a->entries, i);
288.           if (entry->set != set) {

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/x509/x_name.c:286:17: Loop condition is true. Entering loop body
284.       if (!intname.s)
285.           goto memerr;
286.       for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
                       ^
287.           entry = sk_X509_NAME_ENTRY_value(a->entries, i);
288.           if (entry->set != set) {

crypto/x509/x_name.c:287:17: Condition is true
285.           goto memerr;
286.       for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
287.           entry = sk_X509_NAME_ENTRY_value(a->entries, i);
                       ^
288.           if (entry->set != set) {
289.               entries = sk_X509_NAME_ENTRY_new_null();

crypto/x509/x_name.c:287:9: 
285.           goto memerr;
286.       for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
287. >         entry = sk_X509_NAME_ENTRY_value(a->entries, i);
288.           if (entry->set != set) {
289.               entries = sk_X509_NAME_ENTRY_new_null();

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/x509/x_name.c:288:13: Taking false branch
286.       for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
287.           entry = sk_X509_NAME_ENTRY_value(a->entries, i);
288.           if (entry->set != set) {
                   ^
289.               entries = sk_X509_NAME_ENTRY_new_null();
290.               if (!entries)

crypto/x509/x_name.c:296:14: Condition is true
294.               set = entry->set;
295.           }
296.           if (!sk_X509_NAME_ENTRY_push(entries, entry))
                    ^
297.               goto memerr;
298.       }

crypto/x509/x_name.c:296:14: Condition is true
294.               set = entry->set;
295.           }
296.           if (!sk_X509_NAME_ENTRY_push(entries, entry))
                    ^
297.               goto memerr;
298.       }

crypto/stack/stack.c:263:1: start of procedure sk_push()
  261.   }
  262.   
  263. > int sk_push(_STACK *st, void *data)
  264.   {
  265.       return (sk_insert(st, data, st->num));

crypto/stack/stack.c:265:5: Skipping sk_insert(): empty list of specs
  263.   int sk_push(_STACK *st, void *data)
  264.   {
  265.       return (sk_insert(st, data, st->num));
             ^
  266.   }
  267.   
