From 4b4aefbddf6a5c7ae608af005dcb445820820a3c Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 23 Apr 2010 12:34:55 +0100 Subject: fix dumb buffer overrun --- calendar/gui/alarm-notify/alarm-queue.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index ce76d83638..ae6eb3e172 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -192,11 +192,14 @@ e_ctime (const time_t *timep) { static char *buffer[4] = { 0, }; static int next = 0; + const char *ret; g_free (buffer[next]); - buffer[next] = g_strdup (ctime (timep)); + ret = buffer[next++] = g_strdup (ctime (timep)); + if (next >= G_N_ELEMENTS (buffer)) + next = 0; - return buffer[next++]; + return ret; } /* Queues an alarm trigger for midnight so that we can load the next day's worth -- cgit