diff options
author | 2001-06-22 21:57:59 +0000 | |
---|---|---|
committer | 2001-06-22 21:57:59 +0000 | |
commit | 311697c8bf36ec388fb327ea0db6c5d848b69295 (patch) | |
tree | da6af19a3e1c86f0cc55abe55b2684934aab2435 /usr.bin/ssh/dh.c | |
parent | Merge heimdal-0.3e -> heidmal-0.3f (diff) | |
download | wireguard-openbsd-311697c8bf36ec388fb327ea0db6c5d848b69295.tar.xz wireguard-openbsd-311697c8bf36ec388fb327ea0db6c5d848b69295.zip |
increase linebuffer to deal with larger moduli; use rewind instead of
close/open
Diffstat (limited to 'usr.bin/ssh/dh.c')
-rw-r--r-- | usr.bin/ssh/dh.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/usr.bin/ssh/dh.c b/usr.bin/ssh/dh.c index 26deb9fbf07..66eb95545b5 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.15 2001/06/22 21:27:07 provos Exp $"); +RCSID("$OpenBSD: dh.c,v 1.16 2001/06/22 21:57:59 provos Exp $"); #include "xmalloc.h" @@ -103,7 +103,7 @@ DH * choose_dh(int min, int wantbits, int max) { FILE *f; - char line[1024]; + char line[2048]; int best, bestcount, which; int linenum; struct dhgroup dhg; @@ -134,18 +134,14 @@ choose_dh(int min, int wantbits, int max) if (dhg.size == best) bestcount++; } - fclose (f); + rewind(f); if (bestcount == 0) { + fclose(f); log("WARNING: no suitable primes in %s", _PATH_DH_PRIMES); return (NULL); } - f = fopen(_PATH_DH_PRIMES, "r"); - if (!f) { - fatal("WARNING: %s disappeared, giving up", _PATH_DH_PRIMES); - } - linenum = 0; which = arc4random() % bestcount; while (fgets(line, sizeof(line), f)) { |