From a9ef4c986984cce821260f46d44d31fd88591c36 Mon Sep 17 00:00:00 2001 From: dzil123 <5725958+dzil123@users.noreply.github.com> Date: Tue, 4 Jun 2024 22:33:02 -0700 Subject: [PATCH 3/8] Fix calloc argument order Signed-off-by: dzil123 <5725958+dzil123@users.noreply.github.com> --- lib/tpm2_openssl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tpm2_openssl.c b/lib/tpm2_openssl.c index ad43c8e1..79e80a5e 100644 --- a/lib/tpm2_openssl.c +++ b/lib/tpm2_openssl.c @@ -422,7 +422,7 @@ static bool do_open_file(FILE *f, const char *path, char **pass) { goto out; } - char *tmp = calloc(sizeof(char), file_size + 1); + char *tmp = calloc(file_size + 1, sizeof(char)); if (!tmp) { LOG_ERR("oom"); goto out; @@ -477,7 +477,7 @@ static bool do_stdin(const char *passin, char **pass) { UNUSED(passin); - void *buf = calloc(sizeof(BYTE), UINT16_MAX + 1); + void *buf = calloc(UINT16_MAX + 1, sizeof(BYTE)); if (!buf) { LOG_ERR("oom"); return false; -- 2.49.0