Always zero memory in crypt_safe_alloc.
authorMilan Broz <gmazyland@gmail.com>
Mon, 27 Aug 2012 13:47:40 +0000 (15:47 +0200)
committerMilan Broz <gmazyland@gmail.com>
Mon, 27 Aug 2012 14:28:00 +0000 (16:28 +0200)
lib/libdevmapper.c
lib/utils_crypt.c

index 6288b34..f711392 100644 (file)
@@ -1125,7 +1125,6 @@ int dm_resume_and_reinstate_key(struct crypt_device *cd, const char *name,
                goto out;
        }
 
-       memset(msg, 0, msg_size);
        strcpy(msg, "key set ");
        hex_key(&msg[8], key_size, key);
 
index 4433dc7..204932f 100644 (file)
@@ -92,6 +92,7 @@ void *crypt_safe_alloc(size_t size)
                return NULL;
 
        alloc->size = size;
+       memset(&alloc->data, 0, size);
 
        return &alloc->data;
 }