if (!ASN1_STRING_set(bs,(unsigned char *)buf,i+1))
if (!ASN1_STRING_set(bs,(unsigned char *)buf,i))
static int add_attribute_object(STACK_OF(X509_ATTRIBUTE) *n, char *text,				char *def, char *value, int nid, int min,				int max)	{	int i,z;	X509_ATTRIBUTE *xa=NULL;	static char buf[1024];	ASN1_BIT_STRING *bs=NULL;	ASN1_TYPE *at=NULL;start:	BIO_printf(bio_err,"%s [%s]:",text,def);	(void)BIO_flush(bio_err);	if (value != NULL)		{		strcpy(buf,value);		strcat(buf,"\n");		BIO_printf(bio_err,"%s\n",value);		}	else		{		buf[0]='\0';		fgets(buf,1024,stdin);		}	if (buf[0] == '\0') return(0);	else if (buf[0] == '\n')		{		if ((def == NULL) || (def[0] == '\0'))			return(1);		strcpy(buf,def);		strcat(buf,"\n");		}	else if ((buf[0] == '.') && (buf[1] == '\n')) return(1);	i=strlen(buf);	if (buf[i-1] != '\n')		{		BIO_printf(bio_err,"weird input :-(\n");		return(0);		}	buf[--i]='\0';	/* add object plus value */	if ((xa=X509_ATTRIBUTE_new()) == NULL)		goto err;	if ((xa->value.set=sk_ASN1_TYPE_new_null()) == NULL)		goto err;	xa->set=1;	if (xa->object != NULL) ASN1_OBJECT_free(xa->object);	xa->object=OBJ_nid2obj(nid);	if ((bs=ASN1_BIT_STRING_new()) == NULL) goto err;	bs->type=ASN1_PRINTABLE_type((unsigned char *)buf,-1);	z=req_fix_data(nid,&bs->type,i,min,max);	if (z == 0)		{		if (value == NULL)			goto start;		else	goto err;		}	if (!ASN1_STRING_set(bs,(unsigned char *)buf,i+1))		{ BIO_printf(bio_err,"Malloc failure\n"); goto err; }	if ((at=ASN1_TYPE_new()) == NULL)		{ BIO_printf(bio_err,"Malloc failure\n"); goto err; }	ASN1_TYPE_set(at,bs->type,(char *)bs);	sk_ASN1_TYPE_push(xa->value.set,at);	bs=NULL;	at=NULL;	/* only one item per attribute */	if (!sk_X509_ATTRIBUTE_push(n,xa)) goto err;	return(1);err:	if (xa != NULL) X509_ATTRIBUTE_free(xa);	if (at != NULL) ASN1_TYPE_free(at);	if (bs != NULL) ASN1_BIT_STRING_free(bs);	return(0);	}