diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2020-04-02 07:25:53 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2020-04-06 11:36:33 +0200 |
commit | 34c596182dfcb7daa3a6659f1a61aab7f74f3a59 (patch) | |
tree | 7e3c684103bdf7c3e2c4cfe01e28b7a4b0bad93c | |
parent | 1a18d9cce271b8b562c69f2e25b49d436ac5e5a0 (diff) | |
download | libssh-34c596182dfcb7daa3a6659f1a61aab7f74f3a59.tar.gz libssh-34c596182dfcb7daa3a6659f1a61aab7f74f3a59.tar.xz libssh-34c596182dfcb7daa3a6659f1a61aab7f74f3a59.zip |
dh-gex: Check return value of ssh_get_random()
CID #1422162
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit d2f0d3270a8733e3e8ad3788e8a315c533c765f9)
-rw-r--r-- | src/dh-gex.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/dh-gex.c b/src/dh-gex.c index 6c75c69e..9bf0546a 100644 --- a/src/dh-gex.c +++ b/src/dh-gex.c @@ -366,8 +366,13 @@ static bool dhgroup_better_size(uint32_t pmin, */ static bool invn_chance(int n) { - uint32_t nounce; - ssh_get_random(&nounce, sizeof(nounce), 0); + uint32_t nounce = 0; + int ok; + + ok = ssh_get_random(&nounce, sizeof(nounce), 0); + if (!ok) { + return false; + } return (nounce % n) == 0; } |