aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2010-09-08 22:57:49 +0800
committerCosimo Cecchi <cosimoc@gnome.org>2010-09-08 22:57:49 +0800
commit366d36a10c2e88306fa2d556570e3def1b0149d6 (patch)
tree88125b00b41a52744a392a5a2ae161b1283bec29
parent127bd46e7c03eb95501e65836c301b1bbb6c8c5d (diff)
downloadgsoc2013-empathy-366d36a10c2e88306fa2d556570e3def1b0149d6.tar
gsoc2013-empathy-366d36a10c2e88306fa2d556570e3def1b0149d6.tar.gz
gsoc2013-empathy-366d36a10c2e88306fa2d556570e3def1b0149d6.tar.bz2
gsoc2013-empathy-366d36a10c2e88306fa2d556570e3def1b0149d6.tar.lz
gsoc2013-empathy-366d36a10c2e88306fa2d556570e3def1b0149d6.tar.xz
gsoc2013-empathy-366d36a10c2e88306fa2d556570e3def1b0149d6.tar.zst
gsoc2013-empathy-366d36a10c2e88306fa2d556570e3def1b0149d6.zip
Make sure we allocate the right size for certificates
-rw-r--r--libempathy/empathy-tls-certificate.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libempathy/empathy-tls-certificate.c b/libempathy/empathy-tls-certificate.c
index f36887dcd..826608fad 100644
--- a/libempathy/empathy-tls-certificate.c
+++ b/libempathy/empathy-tls-certificate.c
@@ -426,16 +426,16 @@ empathy_tls_certificate_reject_finish (EmpathyTLSCertificate *self,
static gsize
get_exported_size (gnutls_x509_crt_t cert)
{
- gsize retval;
- guchar fake;
+ gsize retval = 2;
+ guchar fake[2] = { 0, 0 };
/* fake an export so we get the size to allocate */
gnutls_x509_crt_export (cert, GNUTLS_X509_FMT_PEM,
- &fake, &retval);
+ fake, &retval);
DEBUG ("Should allocate %lu bytes", (gulong) retval);
- return retval;
+ return retval + 1;
}
void
@@ -484,7 +484,8 @@ empathy_tls_certificate_store_ca (EmpathyTLSCertificate *self)
if (res < 0)
{
- DEBUG ("Failed to export the CA certificate; GnuTLS returned %d", res);
+ DEBUG ("Failed to export the CA certificate; GnuTLS returned %d,"
+ "and should be %lu bytes long", res, (gulong) exported_len);
gnutls_x509_crt_deinit (cert);
goto out;