crypto/pkcs7/example.c:289: error: NULL_DEREFERENCE
  pointer `so` last assigned on line 288 could be null and is dereferenced at line 289, column 6.
Showing all 49 steps of the trace


crypto/pkcs7/example.c:277:1: start of procedure sk_get_seq2string()
275.   
276.   /* For this case, I will malloc the return strings */
277. > int sk_get_seq2string(STACK_OF(X509_ATTRIBUTE) *sk, char **str1, char **str2)
278.   	{
279.   	ASN1_TYPE *so;

crypto/pkcs7/example.c:282:6: Taking true branch
280.   	PKCS7_SIGNER_INFO si;
281.   
282.   	if (signed_seq2string_nid == -1)
            ^
283.   		signed_seq2string_nid=
284.   			OBJ_create("1.9.9999","OID_example","Our example OID");

crypto/pkcs7/example.c:283:3: 
281.   
282.   	if (signed_seq2string_nid == -1)
283. > 		signed_seq2string_nid=
284.   			OBJ_create("1.9.9999","OID_example","Our example OID");
285.   

crypto/objects/obj_dat.c:628:1: start of procedure OBJ_create()
  626.   	}
  627.   
  628. > int OBJ_create(char *oid, char *sn, char *ln)
  629.   	{
  630.   	int ok=0;

crypto/objects/obj_dat.c:630:2: 
  628.   int OBJ_create(char *oid, char *sn, char *ln)
  629.   	{
  630. > 	int ok=0;
  631.   	ASN1_OBJECT *op=NULL;
  632.   	unsigned char *buf;

crypto/objects/obj_dat.c:631:2: 
  629.   	{
  630.   	int ok=0;
  631. > 	ASN1_OBJECT *op=NULL;
  632.   	unsigned char *buf;
  633.   	int i;

crypto/objects/obj_dat.c:635:2: Skipping a2d_ASN1_OBJECT(): empty list of specs
  633.   	int i;
  634.   
  635.   	i=a2d_ASN1_OBJECT(NULL,0,oid,-1);
          ^
  636.   	if (i <= 0) return(0);
  637.   

crypto/objects/obj_dat.c:636:6: Taking false branch
  634.   
  635.   	i=a2d_ASN1_OBJECT(NULL,0,oid,-1);
  636.   	if (i <= 0) return(0);
              ^
  637.   
  638.   	if ((buf=(unsigned char *)Malloc(i)) == NULL)

crypto/objects/obj_dat.c:638:6: Taking false branch
  636.   	if (i <= 0) return(0);
  637.   
  638.   	if ((buf=(unsigned char *)Malloc(i)) == NULL)
              ^
  639.   		{
  640.   		OBJerr(OBJ_F_OBJ_CREATE,OBJ_R_MALLOC_FAILURE);

crypto/objects/obj_dat.c:643:2: Skipping a2d_ASN1_OBJECT(): empty list of specs
  641.   		return(0);
  642.   		}
  643.   	i=a2d_ASN1_OBJECT(buf,i,oid,-1);
          ^
  644.   	op=(ASN1_OBJECT *)ASN1_OBJECT_create(OBJ_new_nid(1),buf,i,sn,ln);
  645.   	if (op == NULL) 

crypto/objects/obj_dat.c:644:2: 
  642.   		}
  643.   	i=a2d_ASN1_OBJECT(buf,i,oid,-1);
  644. > 	op=(ASN1_OBJECT *)ASN1_OBJECT_create(OBJ_new_nid(1),buf,i,sn,ln);
  645.   	if (op == NULL) 
  646.   		goto err;

crypto/objects/obj_dat.c:205:1: start of procedure OBJ_new_nid()
    203.   	}
    204.   
    205. > int OBJ_new_nid(int num)
    206.   	{
    207.   	int i;

crypto/objects/obj_dat.c:209:2: 
    207.   	int i;
    208.   
    209. > 	i=new_nid;
    210.   	new_nid+=num;
    211.   	return(i);

crypto/objects/obj_dat.c:210:2: 
    208.   
    209.   	i=new_nid;
    210. > 	new_nid+=num;
    211.   	return(i);
    212.   	}

crypto/objects/obj_dat.c:211:2: 
    209.   	i=new_nid;
    210.   	new_nid+=num;
    211. > 	return(i);
    212.   	}
    213.   

crypto/objects/obj_dat.c:212:2: return from a call to OBJ_new_nid
    210.   	new_nid+=num;
    211.   	return(i);
    212.   	}
            ^
    213.   
    214.   int OBJ_add_object(ASN1_OBJECT *obj)

crypto/asn1/a_object.c:288:1: start of procedure ASN1_OBJECT_create()
    286.   	}
    287.   
    288. > ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
    289.   	     char *sn, char *ln)
    290.   	{

crypto/asn1/a_object.c:293:2: 
    291.   	ASN1_OBJECT o;
    292.   
    293. > 	o.sn=sn;
    294.   	o.ln=ln;
    295.   	o.data=data;

crypto/asn1/a_object.c:294:2: 
    292.   
    293.   	o.sn=sn;
    294. > 	o.ln=ln;
    295.   	o.data=data;
    296.   	o.nid=nid;

crypto/asn1/a_object.c:295:2: 
    293.   	o.sn=sn;
    294.   	o.ln=ln;
    295. > 	o.data=data;
    296.   	o.nid=nid;
    297.   	o.length=len;

crypto/asn1/a_object.c:296:2: 
    294.   	o.ln=ln;
    295.   	o.data=data;
    296. > 	o.nid=nid;
    297.   	o.length=len;
    298.   	o.flags=ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|

crypto/asn1/a_object.c:297:2: 
    295.   	o.data=data;
    296.   	o.nid=nid;
    297. > 	o.length=len;
    298.   	o.flags=ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|
    299.   		ASN1_OBJECT_FLAG_DYNAMIC_DATA;

crypto/asn1/a_object.c:298:2: 
    296.   	o.nid=nid;
    297.   	o.length=len;
    298. > 	o.flags=ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|
    299.   		ASN1_OBJECT_FLAG_DYNAMIC_DATA;
    300.   	return(OBJ_dup(&o));

crypto/asn1/a_object.c:300:2: Skipping OBJ_dup(): empty list of specs
    298.   	o.flags=ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|
    299.   		ASN1_OBJECT_FLAG_DYNAMIC_DATA;
    300.   	return(OBJ_dup(&o));
            ^
    301.   	}
    302.   

crypto/asn1/a_object.c:301:2: return from a call to ASN1_OBJECT_create
    299.   		ASN1_OBJECT_FLAG_DYNAMIC_DATA;
    300.   	return(OBJ_dup(&o));
    301.   	}
            ^
    302.   
    303.   IMPLEMENT_STACK_OF(ASN1_OBJECT)

crypto/objects/obj_dat.c:645:6: Taking false branch
  643.   	i=a2d_ASN1_OBJECT(buf,i,oid,-1);
  644.   	op=(ASN1_OBJECT *)ASN1_OBJECT_create(OBJ_new_nid(1),buf,i,sn,ln);
  645.   	if (op == NULL) 
              ^
  646.   		goto err;
  647.   	ok=OBJ_add_object(op);

crypto/objects/obj_dat.c:647:2: Skipping OBJ_add_object(): empty list of specs
  645.   	if (op == NULL) 
  646.   		goto err;
  647.   	ok=OBJ_add_object(op);
          ^
  648.   err:
  649.   	ASN1_OBJECT_free(op);

crypto/objects/obj_dat.c:648:1: 
  646.   		goto err;
  647.   	ok=OBJ_add_object(op);
  648. > err:
  649.   	ASN1_OBJECT_free(op);
  650.   	Free((char *)buf);

crypto/objects/obj_dat.c:649:2: Skipping ASN1_OBJECT_free(): empty list of specs
  647.   	ok=OBJ_add_object(op);
  648.   err:
  649.   	ASN1_OBJECT_free(op);
          ^
  650.   	Free((char *)buf);
  651.   	return(ok);

crypto/objects/obj_dat.c:650:2: 
  648.   err:
  649.   	ASN1_OBJECT_free(op);
  650. > 	Free((char *)buf);
  651.   	return(ok);
  652.   	}

crypto/objects/obj_dat.c:651:2: 
  649.   	ASN1_OBJECT_free(op);
  650.   	Free((char *)buf);
  651. > 	return(ok);
  652.   	}
  653.   

crypto/objects/obj_dat.c:652:2: return from a call to OBJ_create
  650.   	Free((char *)buf);
  651.   	return(ok);
  652.   	}
          ^
  653.   

crypto/pkcs7/example.c:286:2: 
284.   			OBJ_create("1.9.9999","OID_example","Our example OID");
285.   
286. > 	si.auth_attr=sk;
287.   	/* To retrieve */
288.   	so=PKCS7_get_signed_attribute(&si,signed_seq2string_nid);

crypto/pkcs7/example.c:288:2: 
286.   	si.auth_attr=sk;
287.   	/* To retrieve */
288. > 	so=PKCS7_get_signed_attribute(&si,signed_seq2string_nid);
289.   	if (so->type == V_ASN1_SEQUENCE)
290.   		{

crypto/pkcs7/pk7_doit.c:813:1: start of procedure PKCS7_get_signed_attribute()
  811.   	}
  812.   
  813. > ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid)
  814.   	{
  815.   	return(get_attribute(si->auth_attr,nid));

crypto/pkcs7/pk7_doit.c:815:2: 
  813.   ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid)
  814.   	{
  815. > 	return(get_attribute(si->auth_attr,nid));
  816.   	}
  817.   

crypto/pkcs7/pk7_doit.c:823:1: start of procedure get_attribute()
    821.   	}
    822.   
    823. > static ASN1_TYPE *get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid)
    824.   	{
    825.   	int i;

crypto/pkcs7/pk7_doit.c:829:2: 
    827.   	ASN1_OBJECT *o;
    828.   
    829. > 	o=OBJ_nid2obj(nid);
    830.   	if (!o || !sk) return(NULL);
    831.   	for (i=0; i<sk_X509_ATTRIBUTE_num(sk); i++)

crypto/objects/obj_dat.c:258:1: start of procedure OBJ_nid2obj()
      256.   	}
      257.   
      258. > ASN1_OBJECT *OBJ_nid2obj(int n)
      259.   	{
      260.   	ADDED_OBJ ad,*adp;

crypto/objects/obj_dat.c:263:7: Taking true branch
      261.   	ASN1_OBJECT ob;
      262.   
      263.   	if ((n >= 0) && (n < NUM_NID))
                   ^
      264.   		{
      265.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))

crypto/objects/obj_dat.c:263:19: Taking false branch
      261.   	ASN1_OBJECT ob;
      262.   
      263.   	if ((n >= 0) && (n < NUM_NID))
                               ^
      264.   		{
      265.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))

crypto/objects/obj_dat.c:272:11: Taking true branch
      270.   		return((ASN1_OBJECT *)&(nid_objs[n]));
      271.   		}
      272.   	else if (added == NULL)
                       ^
      273.   		return(NULL);
      274.   	else

crypto/objects/obj_dat.c:273:3: 
      271.   		}
      272.   	else if (added == NULL)
      273. > 		return(NULL);
      274.   	else
      275.   		{

crypto/objects/obj_dat.c:288:2: return from a call to OBJ_nid2obj
      286.   			}
      287.   		}
      288.   	}
              ^
      289.   
      290.   const char *OBJ_nid2sn(int n)

crypto/pkcs7/pk7_doit.c:830:7: Taking true branch
    828.   
    829.   	o=OBJ_nid2obj(nid);
    830.   	if (!o || !sk) return(NULL);
                 ^
    831.   	for (i=0; i<sk_X509_ATTRIBUTE_num(sk); i++)
    832.   		{

crypto/pkcs7/pk7_doit.c:830:17: 
    828.   
    829.   	o=OBJ_nid2obj(nid);
    830. > 	if (!o || !sk) return(NULL);
    831.   	for (i=0; i<sk_X509_ATTRIBUTE_num(sk); i++)
    832.   		{

crypto/pkcs7/pk7_doit.c:843:2: return from a call to get_attribute
    841.   		}
    842.   	return(NULL);
    843.   	}
            ^
    844.   
    845.   ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk)

crypto/pkcs7/pk7_doit.c:816:2: return from a call to PKCS7_get_signed_attribute
  814.   	{
  815.   	return(get_attribute(si->auth_attr,nid));
  816.   	}
          ^
  817.   
  818.   ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid)

crypto/pkcs7/example.c:289:6: 
287.   	/* To retrieve */
288.   	so=PKCS7_get_signed_attribute(&si,signed_seq2string_nid);
289. > 	if (so->type == V_ASN1_SEQUENCE)
290.   		{
291.   		ASN1_CTX c;
