[PATCH] Avoiding Dereferencing of NULL pointer

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



Signed-off-by: krishnaiah bommu <krishnaiah.bommu@xxxxxxxxx>
---
 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

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev



[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux