summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/dh.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2011-12-07 05:44:38 +0000
committerdjm <djm@openbsd.org>2011-12-07 05:44:38 +0000
commita17340500f63a285073739914f89217ba0e0a8c2 (patch)
tree2b42924182d77bbdda15523aab7965eb8bd523ff /usr.bin/ssh/dh.c
parentImplement search support for 24 additional macros, extract more information (diff)
downloadwireguard-openbsd-a17340500f63a285073739914f89217ba0e0a8c2.tar.xz
wireguard-openbsd-a17340500f63a285073739914f89217ba0e0a8c2.zip
fix some harmless and/or unreachable int overflows;
reported Xi Wang, ok markus@
Diffstat (limited to 'usr.bin/ssh/dh.c')
-rw-r--r--usr.bin/ssh/dh.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/ssh/dh.c b/usr.bin/ssh/dh.c
index 2f3bacd9ea3..91644d4dd10 100644
--- a/usr.bin/ssh/dh.c
+++ b/usr.bin/ssh/dh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dh.c,v 1.48 2009/10/01 11:37:33 grunk Exp $ */
+/* $OpenBSD: dh.c,v 1.49 2011/12/07 05:44:38 djm Exp $ */
/*
* Copyright (c) 2000 Niels Provos. All rights reserved.
*
@@ -233,6 +233,8 @@ dh_gen_key(DH *dh, int need)
{
int i, bits_set, tries = 0;
+ if (need < 0)
+ fatal("dh_gen_key: need < 0");
if (dh->p == NULL)
fatal("dh_gen_key: dh->p == NULL");
if (need > INT_MAX / 2 || 2 * need >= BN_num_bits(dh->p))