diff options
author | 2001-04-04 23:09:17 +0000 | |
---|---|---|
committer | 2001-04-04 23:09:17 +0000 | |
commit | 5e42e54620ac5bd9fc05b5e4d2d2cbef2ece74d6 (patch) | |
tree | dc669d6737f93a9110c34b551ee7a131a3055dad /usr.bin/ssh/dh.c | |
parent | Roll Core minor. Ansify source. Handles are now 16 bits. Add (diff) | |
download | wireguard-openbsd-5e42e54620ac5bd9fc05b5e4d2d2cbef2ece74d6.tar.xz wireguard-openbsd-5e42e54620ac5bd9fc05b5e4d2d2cbef2ece74d6.zip |
clear+free keys,iv for rekeying.
+ fix DH mem leaks. ok niels@
Diffstat (limited to 'usr.bin/ssh/dh.c')
-rw-r--r-- | usr.bin/ssh/dh.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/ssh/dh.c b/usr.bin/ssh/dh.c index 03b9fd1b84e..982064f54a1 100644 --- a/usr.bin/ssh/dh.c +++ b/usr.bin/ssh/dh.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: dh.c,v 1.12 2001/04/03 19:53:29 markus Exp $"); +RCSID("$OpenBSD: dh.c,v 1.13 2001/04/04 23:09:17 markus Exp $"); #include "xmalloc.h" @@ -151,11 +151,9 @@ choose_dh(int min, int wantbits, int max) while (fgets(line, sizeof(line), f)) { if (!parse_prime(linenum, line, &dhg)) continue; - if (dhg.size > max || dhg.size < min) - continue; - if (dhg.size != best) - continue; - if (linenum++ != which) { + if ((dhg.size > max || dhg.size < min) || + dhg.size != best || + linenum++ != which) { BN_free(dhg.g); BN_free(dhg.p); continue; @@ -163,6 +161,9 @@ choose_dh(int min, int wantbits, int max) break; } fclose(f); + if (linenum != which+1) + fatal("WARNING: line %d disappeared in %s, giving up", + which, _PATH_DH_PRIMES); return (dh_new_group(dhg.g, dhg.p)); } |