[evolution/express2] fix dumb buffer overrun



commit 4b4aefbddf6a5c7ae608af005dcb445820820a3c
Author: Michael Meeks <michael meeks novell com>
Date:   Fri Apr 23 12:34:55 2010 +0100

    fix dumb buffer overrun

 calendar/gui/alarm-notify/alarm-queue.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index ce76d83..ae6eb3e 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



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