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


crypto/asn1/x_name.c:254:1: start of procedure x509_name_encode()
252.   	}
253.   
254. > static int x509_name_encode(X509_NAME *a)
255.   {
256.   	union { STACK_OF(STACK_OF_X509_NAME_ENTRY) *s;

crypto/asn1/x_name.c:256:2: 
254.   static int x509_name_encode(X509_NAME *a)
255.   {
256. > 	union { STACK_OF(STACK_OF_X509_NAME_ENTRY) *s;
257.   		ASN1_VALUE *a; } intname = {NULL};
258.   	int len;

crypto/asn1/x_name.c:260:2: 
258.   	int len;
259.   	unsigned char *p;
260. > 	STACK_OF(X509_NAME_ENTRY) *entries = NULL;
261.   	X509_NAME_ENTRY *entry;
262.   	int i, set = -1;

crypto/asn1/x_name.c:262:2: 
260.   	STACK_OF(X509_NAME_ENTRY) *entries = NULL;
261.   	X509_NAME_ENTRY *entry;
262. > 	int i, set = -1;
263.   	intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
264.   	if(!intname.s) goto memerr;

crypto/asn1/x_name.c:263:2: 
261.   	X509_NAME_ENTRY *entry;
262.   	int i, set = -1;
263. > 	intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
264.   	if(!intname.s) goto memerr;
265.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {

crypto/stack/stack.c:115:1: start of procedure sk_new_null()
  113.   	}
  114.   
  115. > _STACK *sk_new_null(void)
  116.   	{
  117.   	return sk_new((int (*)(const void *, const void *))0);

crypto/stack/stack.c:117:2: Skipping sk_new(): empty list of specs
  115.   _STACK *sk_new_null(void)
  116.   	{
  117.   	return sk_new((int (*)(const void *, const void *))0);
          ^
  118.   	}
  119.   

crypto/stack/stack.c:118:2: return from a call to sk_new_null
  116.   	{
  117.   	return sk_new((int (*)(const void *, const void *))0);
  118.   	}
          ^
  119.   
  120.   _STACK *sk_new(int (*c)(const void *, const void *))

crypto/asn1/x_name.c:264:6: Taking false branch
262.   	int i, set = -1;
263.   	intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
264.   	if(!intname.s) goto memerr;
            ^
265.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
266.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);

crypto/asn1/x_name.c:265:6: 
263.   	intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
264.   	if(!intname.s) goto memerr;
265. > 	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
266.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
267.   		if(entry->set != set) {

crypto/asn1/x_name.c:265:17: Condition is true
263.   	intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
264.   	if(!intname.s) goto memerr;
265.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
                       ^
266.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
267.   		if(entry->set != set) {

crypto/asn1/x_name.c:265:13: 
263.   	intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
264.   	if(!intname.s) goto memerr;
265. > 	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
266.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
267.   		if(entry->set != set) {

crypto/stack/stack.c:294:1: start of procedure sk_num()
  292.   	}
  293.   
  294. > int sk_num(const _STACK *st)
  295.   {
  296.   	if(st == NULL) return -1;

crypto/stack/stack.c:296:5: Taking false branch
  294.   int sk_num(const _STACK *st)
  295.   {
  296.   	if(st == NULL) return -1;
             ^
  297.   	return st->num;
  298.   }

crypto/stack/stack.c:297:2: 
  295.   {
  296.   	if(st == NULL) return -1;
  297. > 	return st->num;
  298.   }
  299.   

crypto/stack/stack.c:298:1: return from a call to sk_num
  296.   	if(st == NULL) return -1;
  297.   	return st->num;
  298. > }
  299.   
  300.   void *sk_value(const _STACK *st, int i)

crypto/asn1/x_name.c:265:13: Loop condition is true. Entering loop body
263.   	intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
264.   	if(!intname.s) goto memerr;
265.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
                   ^
266.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
267.   		if(entry->set != set) {

crypto/asn1/x_name.c:266:11: Condition is true
264.   	if(!intname.s) goto memerr;
265.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
266.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
                 ^
267.   		if(entry->set != set) {
268.   			entries = sk_X509_NAME_ENTRY_new_null();

crypto/asn1/x_name.c:266:3: 
264.   	if(!intname.s) goto memerr;
265.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
266. > 		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
267.   		if(entry->set != set) {
268.   			entries = sk_X509_NAME_ENTRY_new_null();

crypto/stack/stack.c:300:1: start of procedure sk_value()
  298.   }
  299.   
  300. > void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:302:6: Taking false branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:13: Taking false branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:24: Taking false branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                                ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:303:2: 
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  303. > 	return st->data[i];
  304.   }
  305.   

crypto/stack/stack.c:304:1: return from a call to sk_value
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  303.   	return st->data[i];
  304. > }
  305.   
  306.   void *sk_set(_STACK *st, int i, void *value)

crypto/asn1/x_name.c:267:6: Taking false branch
265.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
266.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
267.   		if(entry->set != set) {
            ^
268.   			entries = sk_X509_NAME_ENTRY_new_null();
269.   			if(!entries) goto memerr;

crypto/asn1/x_name.c:275:7: Condition is true
273.   			set = entry->set;
274.   		}
275.   		if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr;
             ^
276.   	}
277.   	len = ASN1_item_ex_i2d(&intname.a, NULL,

crypto/asn1/x_name.c:275:7: Condition is true
273.   			set = entry->set;
274.   		}
275.   		if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr;
             ^
276.   	}
277.   	len = ASN1_item_ex_i2d(&intname.a, NULL,

crypto/stack/stack.c:244:1: start of procedure sk_push()
  242.   	}
  243.   
  244. > int sk_push(_STACK *st, void *data)
  245.   	{
  246.   	return(sk_insert(st,data,st->num));

crypto/stack/stack.c:246:2: Skipping sk_insert(): empty list of specs
  244.   int sk_push(_STACK *st, void *data)
  245.   	{
  246.   	return(sk_insert(st,data,st->num));
          ^
  247.   	}
  248.   
