[gthumb/ext] checkif the tm struct is valid before setting the date



commit 13cae0f84cd07ff2c86a8b07fb8bb936b43e5982
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Nov 15 21:17:47 2009 +0100

    checkif the tm struct is valid before setting the date

 gthumb/gth-time.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gthumb/gth-time.c b/gthumb/gth-time.c
index 7cb66f2..c73a916 100644
--- a/gthumb/gth-time.c
+++ b/gthumb/gth-time.c
@@ -214,7 +214,7 @@ gth_datetime_from_struct_tm (GthDateTime *dt,
 	else
 		gth_time_set_hms (dt->time, tm->tm_hour, tm->tm_min, tm->tm_sec, 0);
 
-	if (tm->tm_year < 0)
+	if ((tm->tm_year < 0) || (tm->tm_mday < 1) || (tm->tm_mday > 31) || (tm->tm_mon < 0) || (tm->tm_mon > 11))
 		g_date_clear (dt->date, 1);
 	else
 		g_date_set_dmy (dt->date, tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year);



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