aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2020-04-02 07:25:53 +0200
committerAndreas Schneider <asn@cryptomilk.org>2020-04-02 07:25:53 +0200
commitd2f0d3270a8733e3e8ad3788e8a315c533c765f9 (patch)
tree1bfdefb046075e90c99467816b55b14530c85dac /src
parenta9a7c2dc29a27fb4c34490ff3488638563536ac5 (diff)
downloadlibssh-d2f0d3270a8733e3e8ad3788e8a315c533c765f9.tar.gz
libssh-d2f0d3270a8733e3e8ad3788e8a315c533c765f9.tar.xz
libssh-d2f0d3270a8733e3e8ad3788e8a315c533c765f9.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>
Diffstat (limited to 'src')
-rw-r--r--src/dh-gex.c9
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;
}