diff options
author | Simon Josefsson <simon@josefsson.org> | 2008-04-17 11:41:17 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2008-04-17 11:41:17 +0200 |
commit | 595b45ed9162701d8b62e301afaebbee56cbb138 (patch) | |
tree | 5de9632f97fb788696586b05edffd9947b3182db /lib/x509/x509.c | |
parent | 37f27eeb6694288d1985eb89c3fa1f4d0fc6c3e6 (diff) | |
download | gnutls-595b45ed9162701d8b62e301afaebbee56cbb138.tar.gz |
Remove all uses of gnutls_alloca/gnutls_afree.
Use normal gnutls_malloc instead. One reason is increased portability
to Windows, the other is that several of the uses may be unsafe
because the size of data allocated could be large. Reported by
Massimo Gaspari <massimo.gaspari@alice.it> in
<http://permalink.gmane.org/gmane.network.gnutls.general/1170>.
Diffstat (limited to 'lib/x509/x509.c')
-rw-r--r-- | lib/x509/x509.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/x509/x509.c b/lib/x509/x509.c index 6b79560d27..572dd667c0 100644 --- a/lib/x509/x509.c +++ b/lib/x509/x509.c @@ -92,7 +92,7 @@ _gnutls_x509_crt_cpy (gnutls_x509_crt_t dest, gnutls_x509_crt_t src) return ret; } - der = gnutls_alloca (der_size); + der = gnutls_malloc (der_size); if (der == NULL) { gnutls_assert (); @@ -103,7 +103,7 @@ _gnutls_x509_crt_cpy (gnutls_x509_crt_t dest, gnutls_x509_crt_t src) if (ret < 0) { gnutls_assert (); - gnutls_afree (der); + gnutls_free (der); return ret; } @@ -111,7 +111,7 @@ _gnutls_x509_crt_cpy (gnutls_x509_crt_t dest, gnutls_x509_crt_t src) tmp.size = der_size; ret = gnutls_x509_crt_import (dest, &tmp, GNUTLS_X509_FMT_DER); - gnutls_afree (der); + gnutls_free (der); if (ret < 0) { @@ -1962,7 +1962,7 @@ gnutls_x509_crt_get_fingerprint (gnutls_x509_crt_t cert, cert_buf_size = 0; asn1_der_coding (cert->cert, "", NULL, &cert_buf_size, NULL); - cert_buf = gnutls_alloca (cert_buf_size); + cert_buf = gnutls_malloc (cert_buf_size); if (cert_buf == NULL) { gnutls_assert (); @@ -1974,7 +1974,7 @@ gnutls_x509_crt_get_fingerprint (gnutls_x509_crt_t cert, if (result != ASN1_SUCCESS) { gnutls_assert (); - gnutls_afree (cert_buf); + gnutls_free (cert_buf); return _gnutls_asn2err (result); } @@ -1982,7 +1982,7 @@ gnutls_x509_crt_get_fingerprint (gnutls_x509_crt_t cert, tmp.size = cert_buf_size; result = gnutls_fingerprint (algo, &tmp, buf, sizeof_buf); - gnutls_afree (cert_buf); + gnutls_free (cert_buf); return result; } @@ -2157,7 +2157,7 @@ gnutls_x509_crt_get_key_id (gnutls_x509_crt_t crt, unsigned int flags, return _gnutls_asn2err (result); } - pubkey.data = gnutls_alloca (pubkey.size); + pubkey.data = gnutls_malloc (pubkey.size); if (pubkey.data == NULL) { gnutls_assert (); @@ -2169,14 +2169,14 @@ gnutls_x509_crt_get_key_id (gnutls_x509_crt_t crt, unsigned int flags, if (result != ASN1_SUCCESS) { gnutls_assert (); - gnutls_afree (pubkey.data); + gnutls_free (pubkey.data); return _gnutls_asn2err (result); } result = gnutls_fingerprint (GNUTLS_DIG_SHA1, &pubkey, output_data, output_data_size); - gnutls_afree (pubkey.data); + gnutls_free (pubkey.data); return result; } |