summaryrefslogtreecommitdiff
path: root/lib/openpgp/pgp.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2014-03-08 15:42:47 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2014-03-08 15:42:47 +0100
commitac2ec01a3db21f8d9a567ed6438f4840db2c309f (patch)
treef185cc3a1d5dbf43fe7e327212f446c666238c99 /lib/openpgp/pgp.c
parent1fa62995b4950a974b815fcd0a9a6da14648e5df (diff)
downloadgnutls-ac2ec01a3db21f8d9a567ed6438f4840db2c309f.tar.gz
clang warning fixes
Diffstat (limited to 'lib/openpgp/pgp.c')
-rw-r--r--lib/openpgp/pgp.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/openpgp/pgp.c b/lib/openpgp/pgp.c
index e242da187d..6b15e9856b 100644
--- a/lib/openpgp/pgp.c
+++ b/lib/openpgp/pgp.c
@@ -169,7 +169,16 @@ _gnutls_openpgp_export(cdk_kbnode_t node,
if (format == GNUTLS_OPENPGP_FMT_BASE64) {
unsigned char *in = gnutls_calloc(1, *output_data_size);
- memcpy(in, output_data, *output_data_size);
+ if (in == NULL)
+ return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
+
+ rc = cdk_kbnode_write_to_mem(node, in, output_data_size);
+ if (rc) {
+ gnutls_free(in);
+ rc = _gnutls_map_cdk_rc(rc);
+ gnutls_assert();
+ return rc;
+ }
/* Calculate the size of the encoded data and check if the provided
buffer is large enough. */