diff --git a/libpcp/crypto.c b/libpcp/crypto.c index 85bc2b2..909f6f0 100644 --- a/libpcp/crypto.c +++ b/libpcp/crypto.c @@ -169,7 +169,7 @@ size_t pcp_decrypt_stream(PCPCTX *ptx, Pcpstream *in, Pcpstream* out, pcp_key_t 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(PCPCTX *ptx, Pcpstream *in, Pcpstream* out, pcp_key_t #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(ptx, "Error: input file doesn't contain senders public key\n"); goto errdef1; @@ -229,10 +229,12 @@ size_t pcp_decrypt_stream(PCPCTX *ptx, Pcpstream *in, Pcpstream* out, pcp_key_t /* step 4, fetch recipient list and try to decrypt it for us */ + rec_buf = ucmalloc(PCP_ASYM_RECIPIENT_SIZE); for(nrec=0; nrec{test}) { foreach my $test (keys %{$cfg->{test}}) { - my $name = "$test ($cfg->{test}->{$test}->{cmd})"; - if (&runtest($cfg->{test}->{$test}, $name) == 0) { + if (&runtest($cfg->{test}->{$test}, $test) == 0) { return 0; } }