aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2013-09-08 19:32:38 +0000
committerTarmac <Unknown>2013-09-08 19:32:38 +0000
commit0896192c82c10144c184f274943ed692599d7529 (patch)
treecda6d3207e6e77b1417f1b6175c281446d5d686e /src
parentdd9d2e36dfda0eb3b321a1ed94f8d27739265b2a (diff)
parentfde292a8ff3c830ea27f3a11f45e959596fede09 (diff)
downloadayatana-indicator-datetime-0896192c82c10144c184f274943ed692599d7529.tar.gz
ayatana-indicator-datetime-0896192c82c10144c184f274943ed692599d7529.tar.bz2
ayatana-indicator-datetime-0896192c82c10144c184f274943ed692599d7529.zip
Protect against invalid begin or end dates. Fixes: https://bugs.launchpad.net/bugs/1216263.
Approved by PS Jenkins bot, Charles Kerr.
Diffstat (limited to 'src')
-rw-r--r--src/planner.c2
-rw-r--r--src/service.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/src/planner.c b/src/planner.c
index 124aeae..e826c2c 100644
--- a/src/planner.c
+++ b/src/planner.c
@@ -188,6 +188,8 @@ indicator_datetime_planner_get_appointments (IndicatorDatetimePlanner * self,
IndicatorDatetimePlannerClass * klass;
g_return_if_fail (INDICATOR_IS_DATETIME_PLANNER (self));
+ g_return_val_if_fail (begin != NULL, NULL);
+ g_return_val_if_fail (end != NULL, NULL);
klass = INDICATOR_DATETIME_PLANNER_GET_CLASS (self);
g_return_if_fail (klass->get_appointments != NULL);
diff --git a/src/service.c b/src/service.c
index 5d90235..39805a7 100644
--- a/src/service.c
+++ b/src/service.c
@@ -227,7 +227,7 @@ calculate_seconds_until_next_fifteen_minutes (GDateTime * now)
g_date_time_get_day_of_month (next),
g_date_time_get_hour (next),
g_date_time_get_minute (next),
- 1);
+ 0.1);
str = g_date_time_format (start_of_next, "%F %T");
g_debug ("%s %s the next timestamp rebuild will be at %s", G_STRLOC, G_STRFUNC, str);
@@ -299,7 +299,7 @@ calculate_milliseconds_until_next_minute (GDateTime * now)
g_date_time_get_day_of_month (next),
g_date_time_get_hour (next),
g_date_time_get_minute (next),
- 0);
+ 0.1);
interval_usec = g_date_time_difference (start_of_next, now);
interval_msec = (interval_usec + 999) / 1000;
@@ -1640,8 +1640,8 @@ update_appointment_lists (IndicatorDatetimeService * self)
/* get all the appointments in the calendar month */
g_date_time_get_ymd (calendar_date, &y, &m, &d);
- begin = g_date_time_new_local (y, m, 1, 0, 0, 0);
- end = g_date_time_new_local (y, m, g_date_get_days_in_month(m,y), 23, 59, 0);
+ begin = g_date_time_new_local (y, m, 1, 0, 0, 0.1);
+ end = g_date_time_new_local (y, m, g_date_get_days_in_month(m,y), 23, 59, 59.9);
if (begin && end)
indicator_datetime_planner_get_appointments (planner, begin, end,
on_calendar_appointments_ready,