From 3760e59c13c2eb0691249616d6b8e9a076b6690c Mon Sep 17 00:00:00 2001 From: Jon Simons Date: Tue, 29 Jan 2019 20:25:13 -0500 Subject: dh: harden error handling in 'ssh_dh_init_common' Harden the error path in 'ssh_dh_init_common' such that all potential allocations are free'd upon exit. Signed-off-by: Jon Simons Reviewed-by: Andreas Schneider --- src/dh.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dh.c b/src/dh.c index b4b988d9..c40aef5a 100644 --- a/src/dh.c +++ b/src/dh.c @@ -350,6 +350,9 @@ int ssh_dh_init_common(ssh_session session){ break; } if (crypto->x == NULL || crypto->y == NULL || crypto->k == NULL){ + bignum_safe_free(crypto->k); + bignum_safe_free(crypto->y); + bignum_safe_free(crypto->x); ssh_set_error_oom(session); return SSH_ERROR; } else { -- cgit v1.2.3