From 839e023ed88e7c8c42b8ea8bb9e11ffd46668d9c Mon Sep 17 00:00:00 2001
From: Matt Johnston <matt@ucc.asn.au>
Date: Tue, 23 Jun 2015 21:48:13 +0800
Subject: [PATCH] check ecc key return, fix null pointer crash

---
 common-kex.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common-kex.c b/common-kex.c
index 29077151..e2b4f8e5 100644
--- a/common-kex.c
+++ b/common-kex.c
@@ -703,6 +703,9 @@ void kexecdh_comb_key(struct kex_ecdh_param *param, buffer *pub_them,
 	ecc_key *Q_C, *Q_S, *Q_them;
 
 	Q_them = buf_get_ecc_raw_pubkey(pub_them, algo_kex->ecc_curve);
+	if (Q_them == NULL) {
+		dropbear_exit("ECC error");
+	}
 
 	ses.dh_K = dropbear_ecc_shared_secret(Q_them, &param->key);
 
-- 
GitLab