]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dcrypt: Fix uninitialized memory
authorAki Tuomi <aki.tuomi@dovecot.fi>
Fri, 14 Oct 2016 12:28:32 +0000 (15:28 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 17 Oct 2016 20:10:34 +0000 (23:10 +0300)
src/lib-dcrypt/dcrypt-openssl.c
src/lib-dcrypt/test-crypto.c

index 8438a45af3ab8f0726ea2281b001c4944b56ce4d..2011ec4a5dfb182b8d397924d705ef1bcfc794ad 100644 (file)
@@ -729,6 +729,7 @@ static
 bool dcrypt_openssl_generate_keypair(struct dcrypt_keypair *pair_r, enum dcrypt_key_type kind, unsigned int bits, const char *curve, const char **error_r)
 {
        EVP_PKEY *pkey = NULL;
+       memset(pair_r, 0, sizeof(struct dcrypt_keypair));
        if (kind == DCRYPT_KEY_RSA) {
                if (dcrypt_openssl_generate_rsa_key(bits, &pkey, error_r)) {
                        pair_r->priv = i_new(struct dcrypt_private_key, 1);
index d511d308f65afe59ffe6d6e4240693d6563ffc74..a139dd6db0df5983cf1729c99019949e02ac5d9d 100644 (file)
@@ -636,6 +636,7 @@ void test_get_info_pw_encrypted(void) {
        test_begin("test_get_info_pw_encrypted");
 
        struct dcrypt_keypair p1;
+       memset(&p1, 0, sizeof(p1));
        const char *error;
        bool ret = dcrypt_keypair_generate(&p1, DCRYPT_KEY_EC, 0, "sect571k1", &error);
        test_assert(ret == TRUE);