aboutsummaryrefslogtreecommitdiff
path: root/src/session.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2019-01-25 14:12:05 +0100
committerAndreas Schneider <asn@cryptomilk.org>2019-01-25 14:13:10 +0100
commit932102bd134e8548eef3f1893aa0fed444e34582 (patch)
tree1bf9fa2d9f0be86e351946e7bf54fe1c7b515748 /src/session.c
parente260a591f416065ed1444ee2a73592381a6bc02f (diff)
downloadlibssh-932102bd134e8548eef3f1893aa0fed444e34582.tar.gz
libssh-932102bd134e8548eef3f1893aa0fed444e34582.tar.xz
libssh-932102bd134e8548eef3f1893aa0fed444e34582.zip
session: Initialize allocated memory
Found by MemorySanitizer. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/session.c')
-rw-r--r--src/session.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/session.c b/src/session.c
index b79f4548..af9201f8 100644
--- a/src/session.c
+++ b/src/session.c
@@ -1106,7 +1106,7 @@ int ssh_get_publickey_hash(const ssh_key key,
{
SHACTX ctx;
- h = malloc(SHA_DIGEST_LEN);
+ h = calloc(1, SHA_DIGEST_LEN);
if (h == NULL) {
rc = -1;
goto out;
@@ -1129,7 +1129,7 @@ int ssh_get_publickey_hash(const ssh_key key,
{
SHA256CTX ctx;
- h = malloc(SHA256_DIGEST_LEN);
+ h = calloc(1, SHA256_DIGEST_LEN);
if (h == NULL) {
rc = -1;
goto out;
@@ -1152,7 +1152,7 @@ int ssh_get_publickey_hash(const ssh_key key,
{
MD5CTX ctx;
- h = malloc(MD5_DIGEST_LEN);
+ h = calloc(1, MD5_DIGEST_LEN);
if (h == NULL) {
rc = -1;
goto out;