evolution r34890 - in trunk: composer plugins/attachment-reminder
- From: jjohnny svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r34890 - in trunk: composer plugins/attachment-reminder
- Date: Fri, 25 Jan 2008 12:33:56 +0000 (GMT)
Author: jjohnny
Date: Fri Jan 25 12:33:56 2008
New Revision: 34890
URL: http://svn.gnome.org/viewvc/evolution?rev=34890&view=rev
Log:
Fix for #503327 : Fixes memory leaks and a buffer overflow in attachment reminder.
Modified:
trunk/composer/ChangeLog
trunk/composer/e-msg-composer.c
trunk/composer/e-msg-composer.h
trunk/plugins/attachment-reminder/ChangeLog
trunk/plugins/attachment-reminder/attachment-reminder.c
Modified: trunk/composer/e-msg-composer.c
==============================================================================
--- trunk/composer/e-msg-composer.c (original)
+++ trunk/composer/e-msg-composer.c Fri Jan 25 12:33:56 2008
@@ -6262,7 +6262,7 @@
*
* Returns the text/plain of the message from composer
**/
-const gchar *
+GByteArray *
e_msg_composer_get_raw_message_text (EMsgComposer *composer)
{
GByteArray *data = NULL;
@@ -6271,7 +6271,7 @@
data = get_text (p->persist_stream_interface, "text/plain");
if (data)
- return (const gchar *)data->data;
+ return data;
return NULL;
}
Modified: trunk/composer/e-msg-composer.h
==============================================================================
--- trunk/composer/e-msg-composer.h (original)
+++ trunk/composer/e-msg-composer.h Fri Jan 25 12:33:56 2008
@@ -192,7 +192,7 @@
void e_msg_composer_set_saved (EMsgComposer *composer);
void e_msg_composer_set_send_options (EMsgComposer *composer,
gboolean send_enable);
-const gchar * e_msg_composer_get_raw_message_text (EMsgComposer *composer);
+GByteArray * e_msg_composer_get_raw_message_text (EMsgComposer *composer);
struct _EAttachmentBar* e_msg_composer_get_attachment_bar (EMsgComposer *composer);
Modified: trunk/plugins/attachment-reminder/attachment-reminder.c
==============================================================================
--- trunk/plugins/attachment-reminder/attachment-reminder.c (original)
+++ trunk/plugins/attachment-reminder/attachment-reminder.c Fri Jan 25 12:33:56 2008
@@ -94,7 +94,9 @@
org_gnome_evolution_attachment_reminder (EPlugin *ep, EMEventTargetComposer *t)
{
GConfClient *gconf;
- char *rawstr = NULL, *filtered_str = NULL;
+ GByteArray *raw_msg_barray;
+
+ gchar *filtered_str = NULL;
gconf = gconf_client_get_default ();
if (!gconf_client_get_bool (gconf, GCONF_KEY_ATTACHMENT_REMINDER, NULL)){
@@ -103,11 +105,15 @@
} else
g_object_unref (gconf);
- rawstr = g_strdup (e_msg_composer_get_raw_message_text (t->composer));
+ raw_msg_barray = e_msg_composer_get_raw_message_text (t->composer);
+
+ if (!raw_msg_barray)
+ return;
- filtered_str = strip_text_msg (rawstr);
+ raw_msg_barray = g_byte_array_append (raw_msg_barray, (const guint8 *)"", 1);
- g_free (rawstr);
+ filtered_str = strip_text_msg (raw_msg_barray->data);
+ g_byte_array_free (raw_msg_barray, TRUE);
/* Set presend_check_status for the composer*/
if (check_for_attachment_clues (filtered_str) && !check_for_attachment (t->composer))
@@ -136,6 +142,7 @@
gconf = gconf_client_get_default ();
+
/* Get the list from gconf */
clue_list = gconf_client_get_list ( gconf, GCONF_KEY_ATTACH_REMINDER_CLUES, GCONF_VALUE_STRING, NULL );
@@ -176,12 +183,13 @@
{
gchar **lines = g_strsplit ( msg, "\n", -1);
gchar *stripped_msg = g_strdup (" ");
-
guint i=0;
+ gchar *temp;
while (lines [i]){
if (lines [i] != NULL && !g_str_has_prefix (g_strstrip(lines[i]), ">")){
- gchar *temp = stripped_msg;
+ temp = stripped_msg;
+
stripped_msg = g_strconcat (" ", stripped_msg, lines[i], NULL);
g_free (temp);
@@ -191,7 +199,10 @@
g_strfreev (lines);
- return g_utf8_strdown (stripped_msg, -1);
+ temp = g_utf8_strdown (stripped_msg, -1);
+ g_free (stripped_msg);
+
+ return temp;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]