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


crypto/asn1/x_name.c:217:1: start of procedure x509_name_encode()
215.   }
216.   
217. > static int x509_name_encode(X509_NAME *a)
218.   {
219.   	STACK *intname = NULL;

crypto/asn1/x_name.c:219:2: 
217.   static int x509_name_encode(X509_NAME *a)
218.   {
219. > 	STACK *intname = NULL;
220.   	int len;
221.   	unsigned char *p;

crypto/asn1/x_name.c:222:2: 
220.   	int len;
221.   	unsigned char *p;
222. > 	STACK_OF(X509_NAME_ENTRY) *entries = NULL;
223.   	X509_NAME_ENTRY *entry;
224.   	int i, set = -1;

crypto/asn1/x_name.c:224:2: 
222.   	STACK_OF(X509_NAME_ENTRY) *entries = NULL;
223.   	X509_NAME_ENTRY *entry;
224. > 	int i, set = -1;
225.   	intname = sk_new_null();
226.   	if(!intname) goto memerr;

crypto/asn1/x_name.c:225:2: 
223.   	X509_NAME_ENTRY *entry;
224.   	int i, set = -1;
225. > 	intname = sk_new_null();
226.   	if(!intname) goto memerr;
227.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {

crypto/stack/stack.c:112:1: start of procedure sk_new_null()
  110.   	}
  111.   
  112. > STACK *sk_new_null(void)
  113.   	{
  114.   	return sk_new((int (*)(const char * const *, const char * const *))0);

crypto/stack/stack.c:114:2: Skipping sk_new(): empty list of specs
  112.   STACK *sk_new_null(void)
  113.   	{
  114.   	return sk_new((int (*)(const char * const *, const char * const *))0);
          ^
  115.   	}
  116.   

crypto/stack/stack.c:115:2: return from a call to sk_new_null
  113.   	{
  114.   	return sk_new((int (*)(const char * const *, const char * const *))0);
  115.   	}
          ^
  116.   
  117.   STACK *sk_new(int (*c)(const char * const *, const char * const *))

crypto/asn1/x_name.c:226:6: Taking false branch
224.   	int i, set = -1;
225.   	intname = sk_new_null();
226.   	if(!intname) goto memerr;
            ^
227.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
228.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);

crypto/asn1/x_name.c:227:6: 
225.   	intname = sk_new_null();
226.   	if(!intname) goto memerr;
227. > 	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
228.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
229.   		if(entry->set != set) {

crypto/asn1/x_name.c:227:13: 
225.   	intname = sk_new_null();
226.   	if(!intname) goto memerr;
227. > 	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
228.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
229.   		if(entry->set != set) {

crypto/stack/stack.c:299:1: start of procedure sk_num()
  297.   	}
  298.   
  299. > int sk_num(const STACK *st)
  300.   {
  301.   	if(st == NULL) return -1;

crypto/stack/stack.c:301:5: Taking false branch
  299.   int sk_num(const STACK *st)
  300.   {
  301.   	if(st == NULL) return -1;
             ^
  302.   	return st->num;
  303.   }

crypto/stack/stack.c:302:2: 
  300.   {
  301.   	if(st == NULL) return -1;
  302. > 	return st->num;
  303.   }
  304.   

crypto/stack/stack.c:303:1: return from a call to sk_num
  301.   	if(st == NULL) return -1;
  302.   	return st->num;
  303. > }
  304.   
  305.   char *sk_value(const STACK *st, int i)

crypto/asn1/x_name.c:227:13: Loop condition is true. Entering loop body
225.   	intname = sk_new_null();
226.   	if(!intname) goto memerr;
227.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
                   ^
228.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
229.   		if(entry->set != set) {

crypto/asn1/x_name.c:228:3: 
226.   	if(!intname) goto memerr;
227.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
228. > 		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
229.   		if(entry->set != set) {
230.   			entries = sk_X509_NAME_ENTRY_new_null();

crypto/stack/stack.c:305:1: start of procedure sk_value()
  303.   }
  304.   
  305. > char *sk_value(const STACK *st, int i)
  306.   {
  307.   	if(st == NULL) return NULL;

crypto/stack/stack.c:307:5: Taking false branch
  305.   char *sk_value(const STACK *st, int i)
  306.   {
  307.   	if(st == NULL) return NULL;
             ^
  308.   	return st->data[i];
  309.   }

crypto/stack/stack.c:308:2: 
  306.   {
  307.   	if(st == NULL) return NULL;
  308. > 	return st->data[i];
  309.   }
  310.   

crypto/stack/stack.c:309:1: return from a call to sk_value
  307.   	if(st == NULL) return NULL;
  308.   	return st->data[i];
  309. > }
  310.   
  311.   char *sk_set(STACK *st, int i, char *value)

crypto/asn1/x_name.c:229:6: Taking false branch
227.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
228.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
229.   		if(entry->set != set) {
            ^
230.   			entries = sk_X509_NAME_ENTRY_new_null();
231.   			if(!entries) goto memerr;

crypto/asn1/x_name.c:235:7: 
233.   			set = entry->set;
234.   		}
235. > 		if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr;
236.   	}
237.   	len = ASN1_item_ex_i2d((ASN1_VALUE **)&intname, NULL, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);

crypto/stack/stack.c:249:1: start of procedure sk_push()
  247.   	}
  248.   
  249. > int sk_push(STACK *st, char *data)
  250.   	{
  251.   	return(sk_insert(st,data,st->num));

crypto/stack/stack.c:251:2: Skipping sk_insert(): empty list of specs
  249.   int sk_push(STACK *st, char *data)
  250.   	{
  251.   	return(sk_insert(st,data,st->num));
          ^
  252.   	}
  253.   
