From 0476fa07952de15b598fc0fe588337dc8c710606 Mon Sep 17 00:00:00 2001 From: "git@daemon.de" Date: Tue, 18 Mar 2014 09:56:30 +0100 Subject: [PATCH] get rid of static buffers --- libpcp/crypto.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/libpcp/crypto.c b/libpcp/crypto.c index 0e5a329..8d6bc88 100644 --- a/libpcp/crypto.c +++ b/libpcp/crypto.c @@ -169,7 +169,7 @@ size_t pcp_decrypt_stream(Pcpstream *in, Pcpstream* out, pcp_key_t *s, byte *sym byte head[1]; size_t cur_bufsize, rec_size, nrec; - byte rec_buf[PCP_ASYM_RECIPIENT_SIZE]; + byte *rec_buf = NULL; #ifdef PCP_ASYM_ADD_SENDER_PUB byte *senderpub; @@ -207,7 +207,7 @@ size_t pcp_decrypt_stream(Pcpstream *in, Pcpstream* out, pcp_key_t *s, byte *sym #ifdef PCP_ASYM_ADD_SENDER_PUB /* step 2, sender's pubkey */ - cur_bufsize = ps_read(in, &in_buf, crypto_box_PUBLICKEYBYTES); /* fread(&in_buf, 1, crypto_box_PUBLICKEYBYTES, in); */ + cur_bufsize = ps_read(in, &in_buf, crypto_box_PUBLICKEYBYTES); if(cur_bufsize != crypto_box_PUBLICKEYBYTES && !ps_end(in) && !ps_err(in)) { fatal("Error: input file doesn't contain senders public key\n"); goto errdef1; @@ -229,10 +229,12 @@ size_t pcp_decrypt_stream(Pcpstream *in, Pcpstream* out, pcp_key_t *s, byte *sym /* step 4, fetch recipient list and try to decrypt it for us */ + rec_buf = ucmalloc(PCP_ASYM_RECIPIENT_SIZE); for(nrec=0; nrec