apps/pkcs12.c:872: error: NULL_DEREFERENCE
  pointer `av` last assigned on line 871 could be null and is dereferenced at line 872, column 11.
Showing all 64 steps of the trace


apps/pkcs12.c:846:1: start of procedure print_attribs()
844.   /* Generalised attribute print: handle PKCS#8 and bag attributes */
845.   
846. > int print_attribs (BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst, char *name)
847.   {
848.   	X509_ATTRIBUTE *attr;

apps/pkcs12.c:852:6: Taking false branch
850.   	char *value;
851.   	int i, attr_nid;
852.   	if(!attrlst) {
            ^
853.   		BIO_printf(out, "%s: <No Attributes>\n", name);
854.   		return 1;

apps/pkcs12.c:856:6: 
854.   		return 1;
855.   	}
856. > 	if(!sk_X509_ATTRIBUTE_num(attrlst)) {
857.   		BIO_printf(out, "%s: <Empty Attributes>\n", name);
858.   		return 1;

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)

apps/pkcs12.c:856:6: Taking false branch
854.   		return 1;
855.   	}
856.   	if(!sk_X509_ATTRIBUTE_num(attrlst)) {
            ^
857.   		BIO_printf(out, "%s: <Empty Attributes>\n", name);
858.   		return 1;

apps/pkcs12.c:860:2: Skipping BIO_printf(): empty list of specs
858.   		return 1;
859.   	}
860.   	BIO_printf(out, "%s\n", name);
        ^
861.   	for(i = 0; i < sk_X509_ATTRIBUTE_num(attrlst); i++) {
862.   		attr = sk_X509_ATTRIBUTE_value(attrlst, i);

apps/pkcs12.c:861:6: 
859.   	}
860.   	BIO_printf(out, "%s\n", name);
861. > 	for(i = 0; i < sk_X509_ATTRIBUTE_num(attrlst); i++) {
862.   		attr = sk_X509_ATTRIBUTE_value(attrlst, i);
863.   		attr_nid = OBJ_obj2nid(attr->object);

apps/pkcs12.c:861:13: 
859.   	}
860.   	BIO_printf(out, "%s\n", name);
861. > 	for(i = 0; i < sk_X509_ATTRIBUTE_num(attrlst); i++) {
862.   		attr = sk_X509_ATTRIBUTE_value(attrlst, i);
863.   		attr_nid = OBJ_obj2nid(attr->object);

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)

apps/pkcs12.c:861:13: Loop condition is true. Entering loop body
859.   	}
860.   	BIO_printf(out, "%s\n", name);
861.   	for(i = 0; i < sk_X509_ATTRIBUTE_num(attrlst); i++) {
                   ^
862.   		attr = sk_X509_ATTRIBUTE_value(attrlst, i);
863.   		attr_nid = OBJ_obj2nid(attr->object);

apps/pkcs12.c:862:3: 
860.   	BIO_printf(out, "%s\n", name);
861.   	for(i = 0; i < sk_X509_ATTRIBUTE_num(attrlst); i++) {
862. > 		attr = sk_X509_ATTRIBUTE_value(attrlst, i);
863.   		attr_nid = OBJ_obj2nid(attr->object);
864.   		BIO_printf(out, "    ");

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)

apps/pkcs12.c:863:3: 
861.   	for(i = 0; i < sk_X509_ATTRIBUTE_num(attrlst); i++) {
862.   		attr = sk_X509_ATTRIBUTE_value(attrlst, i);
863. > 		attr_nid = OBJ_obj2nid(attr->object);
864.   		BIO_printf(out, "    ");
865.   		if(attr_nid == NID_undef) {

crypto/objects/obj_dat.c:356:1: start of procedure OBJ_obj2nid()
  354.   	}
  355.   
  356. > int OBJ_obj2nid(ASN1_OBJECT *a)
  357.   	{
  358.   	ASN1_OBJECT **op;

crypto/objects/obj_dat.c:361:6: Taking true branch
  359.   	ADDED_OBJ ad,*adp;
  360.   
  361.   	if (a == NULL)
              ^
  362.   		return(NID_undef);
  363.   	if (a->nid != 0)

crypto/objects/obj_dat.c:362:3: 
  360.   
  361.   	if (a == NULL)
  362. > 		return(NID_undef);
  363.   	if (a->nid != 0)
  364.   		return(a->nid);

crypto/objects/obj_dat.c:378:2: return from a call to OBJ_obj2nid
  376.   		return(NID_undef);
  377.   	return((*op)->nid);
  378.   	}
          ^
  379.   
  380.   /* Convert an object name into an ASN1_OBJECT

apps/pkcs12.c:864:3: Skipping BIO_printf(): empty list of specs
862.   		attr = sk_X509_ATTRIBUTE_value(attrlst, i);
863.   		attr_nid = OBJ_obj2nid(attr->object);
864.   		BIO_printf(out, "    ");
         ^
865.   		if(attr_nid == NID_undef) {
866.   			i2a_ASN1_OBJECT (out, attr->object);

apps/pkcs12.c:865:6: Taking true branch
863.   		attr_nid = OBJ_obj2nid(attr->object);
864.   		BIO_printf(out, "    ");
865.   		if(attr_nid == NID_undef) {
            ^
866.   			i2a_ASN1_OBJECT (out, attr->object);
867.   			BIO_printf(out, ": ");

apps/pkcs12.c:866:4: 
864.   		BIO_printf(out, "    ");
865.   		if(attr_nid == NID_undef) {
866. > 			i2a_ASN1_OBJECT (out, attr->object);
867.   			BIO_printf(out, ": ");
868.   		} else BIO_printf(out, "%s: ", OBJ_nid2ln(attr_nid));

crypto/asn1/a_object.c:178:1: start of procedure i2a_ASN1_OBJECT()
  176.   }
  177.   
  178. > int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a)
  179.   	{
  180.   	char buf[80];

crypto/asn1/a_object.c:183:7: Taking true branch
  181.   	int i;
  182.   
  183.   	if ((a == NULL) || (a->data == NULL))
               ^
  184.   		return(BIO_write(bp,"NULL",4));
  185.   	i=i2t_ASN1_OBJECT(buf,80,a);

crypto/asn1/a_object.c:184:3: 
  182.   
  183.   	if ((a == NULL) || (a->data == NULL))
  184. > 		return(BIO_write(bp,"NULL",4));
  185.   	i=i2t_ASN1_OBJECT(buf,80,a);
  186.   	if (i > 80) i=80;

crypto/bio/bio_lib.c:175:1: start of procedure BIO_write()
    173.   	}
    174.   
    175. > int BIO_write(BIO *b, const void *in, int inl)
    176.   	{
    177.   	int i;

crypto/bio/bio_lib.c:180:6: Taking false branch
    178.   	long (*cb)();
    179.   
    180.   	if (b == NULL)
                ^
    181.   		return(0);
    182.   

crypto/bio/bio_lib.c:183:2: 
    181.   		return(0);
    182.   
    183. > 	cb=b->callback;
    184.   	if ((b->method == NULL) || (b->method->bwrite == NULL))
    185.   		{

crypto/bio/bio_lib.c:184:7: Taking false branch
    182.   
    183.   	cb=b->callback;
    184.   	if ((b->method == NULL) || (b->method->bwrite == NULL))
                 ^
    185.   		{
    186.   		BIOerr(BIO_F_BIO_WRITE,BIO_R_UNSUPPORTED_METHOD);

crypto/bio/bio_lib.c:184:30: Taking true branch
    182.   
    183.   	cb=b->callback;
    184.   	if ((b->method == NULL) || (b->method->bwrite == NULL))
                                        ^
    185.   		{
    186.   		BIOerr(BIO_F_BIO_WRITE,BIO_R_UNSUPPORTED_METHOD);

crypto/bio/bio_lib.c:186:3: 
    184.   	if ((b->method == NULL) || (b->method->bwrite == NULL))
    185.   		{
    186. > 		BIOerr(BIO_F_BIO_WRITE,BIO_R_UNSUPPORTED_METHOD);
    187.   		return(-2);
    188.   		}

crypto/err/err.c:353:1: start of procedure ERR_put_error()
      351.   /********************************************************/
      352.   
      353. > void ERR_put_error(int lib, int func, int reason, const char *file,
      354.   	     int line)
      355.   	{

crypto/err/err.c:377:2: Skipping ERR_get_state(): empty list of specs
      375.   	}
      376.   #endif
      377.   	es=ERR_get_state();
              ^
      378.   
      379.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:379:2: 
      377.   	es=ERR_get_state();
      378.   
      379. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
      380.   	if (es->top == es->bottom)
      381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:380:6: Taking false branch
      378.   
      379.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
      380.   	if (es->top == es->bottom)
                  ^
      381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:382:2: 
      380.   	if (es->top == es->bottom)
      381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      382. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      383.   	es->err_file[es->top]=file;
      384.   	es->err_line[es->top]=line;

crypto/err/err.c:383:2: 
      381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      383. > 	es->err_file[es->top]=file;
      384.   	es->err_line[es->top]=line;
      385.   	err_clear_data(es,es->top);

crypto/err/err.c:384:2: 
      382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      383.   	es->err_file[es->top]=file;
      384. > 	es->err_line[es->top]=line;
      385.   	err_clear_data(es,es->top);
      386.   	}

crypto/err/err.c:385:2: Taking true branch
      383.   	es->err_file[es->top]=file;
      384.   	es->err_line[es->top]=line;
      385.   	err_clear_data(es,es->top);
              ^
      386.   	}
      387.   

crypto/err/err.c:385:2: Taking false branch
      383.   	es->err_file[es->top]=file;
      384.   	es->err_line[es->top]=line;
      385.   	err_clear_data(es,es->top);
              ^
      386.   	}
      387.   

crypto/err/err.c:386:2: return from a call to ERR_put_error
      384.   	es->err_line[es->top]=line;
      385.   	err_clear_data(es,es->top);
      386.   	}
              ^
      387.   
      388.   void ERR_clear_error(void)

crypto/bio/bio_lib.c:187:3: 
    185.   		{
    186.   		BIOerr(BIO_F_BIO_WRITE,BIO_R_UNSUPPORTED_METHOD);
    187. > 		return(-2);
    188.   		}
    189.   

crypto/bio/bio_lib.c:214:2: return from a call to BIO_write
    212.   			0L,(long)i);
    213.   	return(i);
    214.   	}
            ^
    215.   
    216.   int BIO_puts(BIO *b, const char *in)

crypto/asn1/a_object.c:189:2: return from a call to i2a_ASN1_OBJECT
  187.   	BIO_write(bp,buf,i);
  188.   	return(i);
  189.   	}
          ^
  190.   
  191.   ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, unsigned char **pp,

apps/pkcs12.c:867:4: Skipping BIO_printf(): empty list of specs
865.   		if(attr_nid == NID_undef) {
866.   			i2a_ASN1_OBJECT (out, attr->object);
867.   			BIO_printf(out, ": ");
          ^
868.   		} else BIO_printf(out, "%s: ", OBJ_nid2ln(attr_nid));
869.   

apps/pkcs12.c:870:6: 
868.   		} else BIO_printf(out, "%s: ", OBJ_nid2ln(attr_nid));
869.   
870. > 		if(sk_ASN1_TYPE_num(attr->value.set)) {
871.   			av = sk_ASN1_TYPE_value(attr->value.set, 0);
872.   			switch(av->type) {

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 true branch
  299.   int sk_num(const STACK *st)
  300.   {
  301.   	if(st == NULL) return -1;
             ^
  302.   	return st->num;
  303.   }

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

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)

apps/pkcs12.c:870:6: Taking true branch
868.   		} else BIO_printf(out, "%s: ", OBJ_nid2ln(attr_nid));
869.   
870.   		if(sk_ASN1_TYPE_num(attr->value.set)) {
            ^
871.   			av = sk_ASN1_TYPE_value(attr->value.set, 0);
872.   			switch(av->type) {

apps/pkcs12.c:871:4: 
869.   
870.   		if(sk_ASN1_TYPE_num(attr->value.set)) {
871. > 			av = sk_ASN1_TYPE_value(attr->value.set, 0);
872.   			switch(av->type) {
873.   				case V_ASN1_BMPSTRING:

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 true 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:307:17: 
  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: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)

apps/pkcs12.c:872:4: 
870.   		if(sk_ASN1_TYPE_num(attr->value.set)) {
871.   			av = sk_ASN1_TYPE_value(attr->value.set, 0);
872. > 			switch(av->type) {
873.   				case V_ASN1_BMPSTRING:
874.           			value = uni2asc(av->value.bmpstring->data,
