summaryrefslogtreecommitdiffstats
path: root/crypto/x509/x509_att.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2008-06-26 23:27:31 +0000
committerDr. Stephen Henson <steve@openssl.org>2008-06-26 23:27:31 +0000
commit8528128b2a740d34d3ae1d43c525d7e6ea6d7f37 (patch)
tree88ae9095ddcb99290be423fcf45112de7e9d3418 /crypto/x509/x509_att.c
parenta0f3679b52a803447acfd91d009df3fb3fbc1bb4 (diff)
Update from stable branch.
Diffstat (limited to 'crypto/x509/x509_att.c')
-rw-r--r--crypto/x509/x509_att.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto/x509/x509_att.c b/crypto/x509/x509_att.c
index 2c9061e3d2..98460e8921 100644
--- a/crypto/x509/x509_att.c
+++ b/crypto/x509/x509_att.c
@@ -245,7 +245,7 @@ X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr,
goto err;
if (!X509_ATTRIBUTE_set1_data(ret,atrtype,data,len))
goto err;
-
+
if ((attr != NULL) && (*attr == NULL)) *attr=ret;
return(ret);
err:
@@ -302,6 +302,13 @@ int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *dat
atype = attrtype;
}
if(!(attr->value.set = sk_ASN1_TYPE_new_null())) goto err;
+ attr->single = 0;
+ /* This is a bit naughty because the attribute should really have
+ * at least one value but some types use and zero length SET and
+ * require this.
+ */
+ if (attrtype == 0)
+ return 1;
if(!(ttmp = ASN1_TYPE_new())) goto err;
if ((len == -1) && !(attrtype & MBSTRING_FLAG))
{
@@ -311,7 +318,6 @@ int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *dat
else
ASN1_TYPE_set(ttmp, atype, stmp);
if(!sk_ASN1_TYPE_push(attr->value.set, ttmp)) goto err;
- attr->single = 0;
return 1;
err:
X509err(X509_F_X509_ATTRIBUTE_SET1_DATA, ERR_R_MALLOC_FAILURE);