summaryrefslogtreecommitdiff
path: root/src/CrlExample.c
diff options
context:
space:
mode:
authorFabio Fiorina <fiorinaf@gnutls.org>2003-02-25 22:07:40 +0000
committerFabio Fiorina <fiorinaf@gnutls.org>2003-02-25 22:07:40 +0000
commit0b694f3b2ae54571462ab7b7f1b0ed4ca73d10b1 (patch)
treecf994329907b490d814732b1af7149d3f5aeb35e /src/CrlExample.c
parent53449a4560f3dbded7f48b2929427fa9be4dde54 (diff)
downloadlibtasn1-0b694f3b2ae54571462ab7b7f1b0ed4ca73d10b1.tar.gz
libtasn1-0b694f3b2ae54571462ab7b7f1b0ed4ca73d10b1.tar.bz2
libtasn1-0b694f3b2ae54571462ab7b7f1b0ed4ca73d10b1.zip
add vector length check
Diffstat (limited to 'src/CrlExample.c')
-rw-r--r--src/CrlExample.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/CrlExample.c b/src/CrlExample.c
index 1aafbd7..2eba8c9 100644
--- a/src/CrlExample.c
+++ b/src/CrlExample.c
@@ -194,6 +194,9 @@ create_CRL(node_asn *cert_def, unsigned char *der,int *der_len)
ASN1_TYPE crl=ASN1_TYPE_EMPTY;
ASN1_TYPE value=ASN1_TYPE_EMPTY;
char errorDescription[MAX_ERROR_DESCRIPTION_SIZE];
+ int max_len;
+
+ max_len=*der_len;
result=asn1_create_element(cert_def,"PKIX1Implicit88.CertificateList",&crl);
@@ -226,6 +229,7 @@ create_CRL(node_asn *cert_def, unsigned char *der,int *der_len)
result=asn1_create_element(cert_def,"PKIX1Implicit88.X520countryName",
&value);
result=asn1_write_value(value,"","US",2);
+ *der_len=max_len;
result=asn1_der_coding(value,"",der,der_len,errorDescription);
asn1_delete_structure(&value);
@@ -242,6 +246,7 @@ create_CRL(node_asn *cert_def, unsigned char *der,int *der_len)
&value);
result=asn1_write_value(value,"","printableString",1);
result=asn1_write_value(value,"printableString","gov",3);
+ *der_len=max_len;
result=asn1_der_coding(value,"",der,der_len,errorDescription);
asn1_delete_structure(&value);
result=asn1_write_value(crl,"tbsCertList.issuer.rdnSequence.?LAST.?LAST.value",der,*der_len);
@@ -257,6 +262,7 @@ create_CRL(node_asn *cert_def, unsigned char *der,int *der_len)
result=asn1_create_element(cert_def,"PKIX1Implicit88.X520OrganizationalUnitName",&value);
result=asn1_write_value(value,"","printableString",1);
result=asn1_write_value(value,"printableString","nist",4);
+ *der_len=max_len;
result=asn1_der_coding(value,"",der,der_len,errorDescription);
asn1_delete_structure(&value);
result=asn1_write_value(crl,"tbsCertList.issuer.rdnSequence.?LAST.?LAST.value",der,*der_len);
@@ -298,6 +304,7 @@ create_CRL(node_asn *cert_def, unsigned char *der,int *der_len)
result=asn1_write_value(crl,"signatureAlgorithm.parameters",NULL,0); /* NO OPTION */
/* signature */
+ *der_len=max_len;
result=asn1_der_coding(crl,"tbsCertList",der,der_len,errorDescription);
if(result!=ASN1_SUCCESS){
printf("\n'tbsCertList' encoding creation: ERROR\n");
@@ -313,7 +320,7 @@ create_CRL(node_asn *cert_def, unsigned char *der,int *der_len)
asn1_visit_tree(crl,"");
printf("-----------------\n"); */
-
+ *der_len=max_len;
result=asn1_der_coding(crl,"",der,der_len,errorDescription);
if(result!=ASN1_SUCCESS){
printf("\n'crl1' encoding creation: ERROR\n");
@@ -424,7 +431,7 @@ main(int argc,char *argv[])
asn1_visit_tree(cert_def,"PKIX1Implicit88");
printf("-----------------\n"); */
-
+ der_len=1024;
create_CRL(PKIX1Implicit88,der,&der_len);