[evolution/gnome-3-32] Change buffer size argument value in call of icalvalue_decode_ical_string()



commit 9e7394528c0d2ab9a2fab819f73145372fbc5e91
Author: Milan Crha <mcrha redhat com>
Date:   Thu May 23 23:02:42 2019 +0200

    Change buffer size argument value in call of icalvalue_decode_ical_string()
    
    Since libical 3.0.5 the buffer size argument should include also
    the nul-terminating character, otherwise the function rejects to
    write the decoded data into the passed-in buffer. The code allocates
    one extra character just in case some older libical would write to it.

 src/calendar/gui/e-comp-editor-page-attachments.c | 2 +-
 src/calendar/gui/e-comp-editor.c                  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/calendar/gui/e-comp-editor-page-attachments.c 
b/src/calendar/gui/e-comp-editor-page-attachments.c
index 5fe0fd3ee9..e1703bbb7b 100644
--- a/src/calendar/gui/e-comp-editor-page-attachments.c
+++ b/src/calendar/gui/e-comp-editor-page-attachments.c
@@ -297,7 +297,7 @@ ecep_attachments_fill_widgets (ECompEditorPage *page,
                        gsize buf_size;
 
                        data = icalattach_get_url (attach);
-                       buf_size = strlen (data);
+                       buf_size = strlen (data) + 1;
                        uri = g_malloc0 (buf_size + 1);
 
                        icalvalue_decode_ical_string (data, uri, buf_size);
diff --git a/src/calendar/gui/e-comp-editor.c b/src/calendar/gui/e-comp-editor.c
index 455a897eaa..b7ad1aa889 100644
--- a/src/calendar/gui/e-comp-editor.c
+++ b/src/calendar/gui/e-comp-editor.c
@@ -666,7 +666,7 @@ ece_save_component_attachments_sync (ECalClient *cal_client,
                        gsize buf_size;
 
                        data = icalattach_get_url (attach);
-                       buf_size = strlen (data);
+                       buf_size = strlen (data) + 1;
                        uri = g_malloc0 (buf_size + 1);
 
                        icalvalue_decode_ical_string (data, uri, buf_size);


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