diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 56830b022..383ddd84b 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; } }