From 1e271b664a4b7cfa1a7d41bef5b2018b2e842d0a Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 27 Feb 2015 21:03:06 -0800 Subject: [PATCH] libdmsg - add safeties * Preinitialize return counters to 0 as a safety. Not required for proper operation. --- lib/libdmsg/crypto.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libdmsg/crypto.c b/lib/libdmsg/crypto.c index 88e48e3f03..55eca1e3c5 100644 --- a/lib/libdmsg/crypto.c +++ b/lib/libdmsg/crypto.c @@ -209,10 +209,12 @@ dmsg_crypto_gcm_encrypt_chunk(dmsg_ioq_t *ioq, char *ct, char *pt, if (!ok) goto fail; + u_len = 0; /* safety */ ok = EVP_EncryptUpdate(&ioq->ctx, ct, &u_len, pt, in_size); if (!ok) goto fail; + f_len = 0; /* safety */ ok = EVP_EncryptFinal(&ioq->ctx, ct + u_len, &f_len); if (!ok) goto fail; -- 2.11.4.GIT