summaryrefslogtreecommitdiff
path: root/dh.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2011-12-19 10:52:50 +1100
committerDamien Miller <djm@mindrot.org>2011-12-19 10:52:50 +1100
commit8ed4de8f1dcebddd7edc0dd3c10f1cb947d831eb (patch)
tree3c9442e4dfcae3662f42cb53cccc7e45f98c0897 /dh.c
parent913ddff40d090751d50be2339cd859505b24f65b (diff)
downloadopenssh-git-8ed4de8f1dcebddd7edc0dd3c10f1cb947d831eb.tar.gz
- djm@cvs.openbsd.org 2011/12/07 05:44:38
[auth2.c dh.c packet.c roaming.h roaming_client.c roaming_common.c] fix some harmless and/or unreachable int overflows; reported Xi Wang, ok markus@
Diffstat (limited to 'dh.c')
-rw-r--r--dh.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/dh.c b/dh.c
index b9029d86..d943ca1e 100644
--- a/dh.c
+++ b/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.
*
@@ -236,6 +236,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))