[evolution] Sanitize values from GConf before using them
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Subject: [evolution] Sanitize values from GConf before using them
- Date: Mon, 27 Apr 2009 06:18:19 -0400 (EDT)
commit d4def43e4d7fba2b8a123b7d11af8170b0f93a1b
Author: Milan Crha <mcrha redhat com>
Date: Mon Apr 27 12:13:35 2009 +0200
Sanitize values from GConf before using them
** Fix for bug #491755
* gui/alarm-notify/config-data.c:
(config_data_set_last_notification_time),
(config_data_get_last_notification_time):
Sanitize values from GConf before using them.
---
calendar/ChangeLog | 9 +++++++++
calendar/gui/alarm-notify/config-data.c | 14 ++++++++++----
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 793c4d7..feba01b 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,14 @@
2009-04-27 Milan Crha <mcrha redhat com>
+ ** Fix for bug #491755
+
+ * gui/alarm-notify/config-data.c:
+ (config_data_set_last_notification_time),
+ (config_data_get_last_notification_time):
+ Sanitize values from GConf before using them.
+
+2009-04-27 Milan Crha <mcrha redhat com>
+
** Fix for bug #575773
* gui/e-calendar-table.etspec:
diff --git a/calendar/gui/alarm-notify/config-data.c b/calendar/gui/alarm-notify/config-data.c
index 81cbc34..5a05cfd 100644
--- a/calendar/gui/alarm-notify/config-data.c
+++ b/calendar/gui/alarm-notify/config-data.c
@@ -259,7 +259,7 @@ void
config_data_set_last_notification_time (time_t t)
{
GConfClient *client;
- time_t current_t;
+ time_t current_t, now = time (NULL);
g_return_if_fail (t != -1);
@@ -269,7 +269,7 @@ config_data_set_last_notification_time (time_t t)
/* we only store the new notification time if it is bigger
than the already stored one */
current_t = gconf_client_get_int (client, KEY_LAST_NOTIFICATION_TIME, NULL);
- if (t > current_t)
+ if (t > current_t || current_t > now)
gconf_client_set_int (client, KEY_LAST_NOTIFICATION_TIME, t, NULL);
}
@@ -290,8 +290,14 @@ config_data_get_last_notification_time (void)
return -1;
value = gconf_client_get_without_default (client, KEY_LAST_NOTIFICATION_TIME, NULL);
- if (value)
- return (time_t) gconf_value_get_int (value);
+ if (value) {
+ time_t val = (time_t) gconf_value_get_int (value), now = time (NULL);
+
+ if (val > now)
+ val = now;
+
+ return val;
+ }
return time (NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]