From fdfc95df8b1d5c7c889e56a1028671a77f6cff5a Mon Sep 17 00:00:00 2001
From: Matt Johnston <matt@ucc.asn.au>
Date: Mon, 16 Aug 2004 08:59:11 +0000
Subject: [PATCH] - don't crash when trying to add to known_hosts if it doesn't
 exist - comments

--HG--
extra : convert_revision : ffafd48c7494fee17a98d901e30c3372e1a092e9
---
 cli-kex.c    | 4 +++-
 common-kex.c | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/cli-kex.c b/cli-kex.c
index dc055014..bad559c6 100644
--- a/cli-kex.c
+++ b/cli-kex.c
@@ -255,5 +255,7 @@ out:
 		fclose(hostsfile);
 	}
 	m_free(filename);
-	buf_free(line);
+	if (line != NULL) {
+		buf_free(line);
+	}
 }
diff --git a/common-kex.c b/common-kex.c
index 0654b199..f8bfe978 100644
--- a/common-kex.c
+++ b/common-kex.c
@@ -464,6 +464,8 @@ void recv_msg_kexinit() {
 
 /* Initialises and generate one side of the diffie-hellman key exchange values.
  * See the ietf-secsh-transport draft, section 6, for details */
+/* dh_pub and dh_priv will be initialised by this function, and should be
+ * mp_clear()ed after finished */
 void gen_kexdh_vals(mp_int *dh_pub, mp_int *dh_priv) {
 
 	mp_int dh_p, dh_q, dh_g;
-- 
GitLab