diff options
Diffstat (limited to 'crypto/openssh/moduli.c')
-rw-r--r-- | crypto/openssh/moduli.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/crypto/openssh/moduli.c b/crypto/openssh/moduli.c index bb4dd7b..ed1bdc9 100644 --- a/crypto/openssh/moduli.c +++ b/crypto/openssh/moduli.c @@ -1,4 +1,4 @@ -/* $OpenBSD: moduli.c,v 1.28 2013/10/24 00:49:49 dtucker Exp $ */ +/* $OpenBSD: moduli.c,v 1.30 2015/01/20 23:14:00 deraadt Exp $ */ /* * Copyright 1994 Phil Karn <karn@qualcomm.com> * Copyright 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com> @@ -39,7 +39,9 @@ #include "includes.h" -#include <sys/param.h> +#ifdef WITH_OPENSSL + +#include <sys/param.h> /* MAX */ #include <sys/types.h> #include <openssl/bn.h> @@ -52,6 +54,7 @@ #include <stdarg.h> #include <time.h> #include <unistd.h> +#include <limits.h> #include "xmalloc.h" #include "dh.h" @@ -447,11 +450,11 @@ static void write_checkpoint(char *cpfile, u_int32_t lineno) { FILE *fp; - char tmp[MAXPATHLEN]; + char tmp[PATH_MAX]; int r; r = snprintf(tmp, sizeof(tmp), "%s.XXXXXXXXXX", cpfile); - if (r == -1 || r >= MAXPATHLEN) { + if (r == -1 || r >= PATH_MAX) { logit("write_checkpoint: temp pathname too long"); return; } @@ -461,6 +464,7 @@ write_checkpoint(char *cpfile, u_int32_t lineno) } if ((fp = fdopen(r, "w")) == NULL) { logit("write_checkpoint: fdopen: %s", strerror(errno)); + unlink(tmp); close(r); return; } @@ -801,3 +805,5 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted, return (res); } + +#endif /* WITH_OPENSSL */ |