[evolution] Bug 743875 - Invalid read on message send



commit 8ab60b0f861f1fb42b83fb1a6773cd8083e01aab
Author: Tomas Popela <tpopela redhat com>
Date:   Wed Feb 4 15:54:18 2015 +0100

    Bug 743875 - Invalid read on message send

 e-util/e-html-editor-selection.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index baa5b38..91ff1d4 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -5126,7 +5126,7 @@ find_where_to_break_line (WebKitDOMNode *node,
        gint last_space = 0;
        gint length;
        gint ret_val = 0;
-       gchar* position;
+       gchar* position = NULL;
 
        text_start =  webkit_dom_character_data_get_data (WEBKIT_DOM_CHARACTER_DATA (node));
        length = g_utf8_strlen (text_start, -1);
@@ -5178,9 +5178,10 @@ find_where_to_break_line (WebKitDOMNode *node,
                str = g_utf8_next_char (str);
        } while (*str);
 
-       position = g_utf8_offset_to_pointer (text_start, max_len);
+       if (max_len <= length)
+               position = g_utf8_offset_to_pointer (text_start, max_len);
 
-       if (g_unichar_isspace (g_utf8_get_char (position))) {
+       if (position && g_unichar_isspace (g_utf8_get_char (position))) {
                ret_val = max_len + 1;
        } else {
                if (last_space == 0) {


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