From 03967d62f4ebe2b8e6059d4eb2a36f5b9a461cc7 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Tue, 3 Sep 2019 10:54:11 -0600 Subject: [PATCH] sanity check on resulting ecc size --- wolfcrypt/src/ecc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 6eda8490b..60494847d 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -3592,7 +3592,7 @@ static int wc_ecc_shared_secret_gen_sync(ecc_key* private_key, ecc_point* point, private_key->heap); if (err == MP_OKAY) { x = mp_unsigned_bin_size(curve->prime); - if (*outlen < x) { + if (*outlen < x || (int)x < mp_unsigned_bin_size(result->x)) { err = BUFFER_E; } }