[PATCH] Avoiding Dereferencing of NULL pointer

krishnaiah bommu krishnaiah.bommu at intel.com
Thu Oct 3 18:14:54 AEST 2019


Signed-off-by: krishnaiah bommu <krishnaiah.bommu at intel.com>
---
 moduli.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/moduli.c b/moduli.c
index 578fc48..c1fa484 100644
--- a/moduli.c
+++ b/moduli.c
@@ -153,12 +153,14 @@ static int
 qfileout(FILE * ofile, u_int32_t otype, u_int32_t otests, u_int32_t otries,
     u_int32_t osize, u_int32_t ogenerator, BIGNUM * omodulus)
 {
-	struct tm *gtm;
+	struct tm *gtm = NULL;
 	time_t time_now;
 	int res;
 
 	time(&time_now);
 	gtm = gmtime(&time_now);
+	if (!gtm)
+		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,
-- 
2.7.4



More information about the openssh-unix-dev mailing list