summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2005-05-15 17:37:48 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2005-05-15 17:37:48 +0000
commit3f5b0571c755069e2249b03802743d61e851bfb1 (patch)
treeb3d13351803283999ab54d9dfe9db7ebe8a9a300
parent07a0a81bad20518f29d4b33c7856f338f8536f45 (diff)
downloadgnutls-3f5b0571c755069e2249b03802743d61e851bfb1.tar.gz
corrected some things that could affect 64 bit machines.
-rw-r--r--lib/x509/common.c6
-rw-r--r--lib/x509/pkcs12.c14
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c
index 7e75bb866c..ae6f5e7a29 100644
--- a/lib/x509/common.c
+++ b/lib/x509/common.c
@@ -755,7 +755,7 @@ int _gnutls_x509_decode_octet_string( const char* string_type,
opaque* output, size_t* output_size)
{
ASN1_TYPE c2 = ASN1_TYPE_EMPTY;
-int result;
+int result, tmp_output_size=*output_size;
char strname[64];
if (string_type == NULL)
@@ -781,7 +781,9 @@ char strname[64];
}
- result = asn1_read_value(c2, "", output, output_size);
+ result = asn1_read_value(c2, "", output, &tmp_output_size);
+ *output_size = tmp_output_size;
+
if (result != ASN1_SUCCESS) {
gnutls_assert();
result = _gnutls_asn2err(result);
diff --git a/lib/x509/pkcs12.c b/lib/x509/pkcs12.c
index f9a4ff5ec2..d4ccbe087c 100644
--- a/lib/x509/pkcs12.c
+++ b/lib/x509/pkcs12.c
@@ -326,6 +326,7 @@ _pkcs12_decode_safe_contents(const gnutls_datum_t * content,
gnutls_datum_t attr_val;
int count = 0, i, attributes, j;
char counter[MAX_INT_DIGITS];
+ size_t size;
/* Step 1. Extract the SEQUENCE.
*/
@@ -447,8 +448,11 @@ _pkcs12_decode_safe_contents(const gnutls_datum_t * content,
}
if (strcmp(oid, KEY_ID_OID) == 0) {
- result = _gnutls_x509_decode_octet_string( NULL, attr_val.data, attr_val.size,
- attr_val.data, &attr_val.size);
+ size = attr_val.size;
+
+ result = _gnutls_x509_decode_octet_string( NULL, attr_val.data, size,
+ attr_val.data, &size);
+ attr_val.size = size;
if (result < 0) {
_gnutls_free_datum( &attr_val);
gnutls_assert();
@@ -458,8 +462,10 @@ _pkcs12_decode_safe_contents(const gnutls_datum_t * content,
}
bag->element[i].local_key_id = attr_val;
} else if (strcmp(oid, FRIENDLY_NAME_OID) == 0) {
- result = _gnutls_x509_decode_octet_string( "BMPString", attr_val.data, attr_val.size,
- attr_val.data, &attr_val.size);
+ size = attr_val.size;
+ result = _gnutls_x509_decode_octet_string( "BMPString", attr_val.data, size,
+ attr_val.data, &size);
+ attr_val.size = size;
if (result < 0) {
_gnutls_free_datum( &attr_val);
gnutls_assert();