From 8142fcaf9ed8ff66252deecbfd29fc59d5f2df4f Mon Sep 17 00:00:00 2001 From: "deraadt@openbsd.org" Date: Wed, 3 Jul 2019 03:24:02 +0000 Subject: upstream: snprintf/vsnprintf return < 0 on error, rather than -1. OpenBSD-Commit-ID: a261c421140a0639bb2b66bbceca72bf8239749d --- moduli.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'moduli.c') diff --git a/moduli.c b/moduli.c index 7120415fd..578fc485c 100644 --- a/moduli.c +++ b/moduli.c @@ -1,4 +1,4 @@ -/* $OpenBSD: moduli.c,v 1.34 2019/01/23 09:49:00 dtucker Exp $ */ +/* $OpenBSD: moduli.c,v 1.35 2019/07/03 03:24:02 deraadt Exp $ */ /* * Copyright 1994 Phil Karn * Copyright 1996-1998, 2003 William Allen Simpson @@ -453,7 +453,7 @@ write_checkpoint(char *cpfile, u_int32_t lineno) int r; r = snprintf(tmp, sizeof(tmp), "%s.XXXXXXXXXX", cpfile); - if (r == -1 || r >= PATH_MAX) { + if (r < 0 || r >= PATH_MAX) { logit("write_checkpoint: temp pathname too long"); return; } -- cgit v1.2.3 From 714031a10bbe378a395a93cf1040f4ee1451f45f Mon Sep 17 00:00:00 2001 From: "dtucker@openbsd.org" Date: Fri, 4 Oct 2019 03:26:58 +0000 Subject: upstream: Check for gmtime failure in moduli generation. Based on patch from krishnaiah.bommu@intel.com, ok djm@ OpenBSD-Commit-ID: 4c6a4cde0022188ac83737de08da0e875704eeaa --- moduli.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'moduli.c') diff --git a/moduli.c b/moduli.c index 578fc485c..4f6f8da8d 100644 --- a/moduli.c +++ b/moduli.c @@ -1,4 +1,4 @@ -/* $OpenBSD: moduli.c,v 1.35 2019/07/03 03:24:02 deraadt Exp $ */ +/* $OpenBSD: moduli.c,v 1.36 2019/10/04 03:26:58 dtucker Exp $ */ /* * Copyright 1994 Phil Karn * Copyright 1996-1998, 2003 William Allen Simpson @@ -159,6 +159,8 @@ qfileout(FILE * ofile, u_int32_t otype, u_int32_t otests, u_int32_t otries, time(&time_now); gtm = gmtime(&time_now); + if (gtm == NULL) + return -1; res = fprintf(ofile, "%04d%02d%02d%02d%02d%02d %u %u %u %u %x ", gtm->tm_year + 1900, gtm->tm_mon + 1, gtm->tm_mday, -- cgit v1.2.3