From 9b858f57c507704bccac56fbb24635a93febc602 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Mon, 16 Dec 2019 16:52:45 +0100 Subject: [PATCH] mbedcrypto_missing: Always check return values Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider --- src/mbedcrypto_missing.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mbedcrypto_missing.c b/src/mbedcrypto_missing.c index cf789b13..ac0d688c 100644 --- a/src/mbedcrypto_missing.c +++ b/src/mbedcrypto_missing.c @@ -104,6 +104,9 @@ int ssh_mbedcry_rand(bignum rnd, int bits, int top, int bottom) if (top == 0) { rc = mbedtls_mpi_set_bit(rnd, bits - 1, 0); + if (rc != 0) { + return 0; + } } if (top == 1) {