[evolution-data-server/gnome-3-32] Change buffer size argument value in call of icalvalue_decode_ical_string()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-32] Change buffer size argument value in call of icalvalue_decode_ical_string()
- Date: Thu, 23 May 2019 20:59:14 +0000 (UTC)
commit 565c7421fdd29481927acd7deddfd1e367304194
Author: Milan Crha <mcrha redhat com>
Date: Thu May 23 22:58:44 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/backends/file/e-cal-backend-file.c | 2 +-
src/calendar/libecal/e-cal-component.c | 2 +-
src/calendar/libedata-cal/e-cal-cache.c | 2 +-
src/calendar/libedata-cal/e-cal-meta-backend.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/calendar/backends/file/e-cal-backend-file.c b/src/calendar/backends/file/e-cal-backend-file.c
index b5103ae3b..954a8f448 100644
--- a/src/calendar/backends/file/e-cal-backend-file.c
+++ b/src/calendar/backends/file/e-cal-backend-file.c
@@ -1772,7 +1772,7 @@ add_attach_uris (GSList **attachment_uris,
gsize buf_size;
gchar *buf;
- buf_size = strlen (url);
+ buf_size = strlen (url) + 1;
buf = g_malloc0 (buf_size + 1);
icalvalue_decode_ical_string (url, buf, buf_size);
diff --git a/src/calendar/libecal/e-cal-component.c b/src/calendar/libecal/e-cal-component.c
index a2e2c1fdc..97e467201 100644
--- a/src/calendar/libecal/e-cal-component.c
+++ b/src/calendar/libecal/e-cal-component.c
@@ -1558,7 +1558,7 @@ get_attachment_list (ECalComponent *comp,
*/
icalattach_ref (attachment->attach);
data = icalattach_get_url (attachment->attach);
- buf_size = strlen (data);
+ buf_size = strlen (data) + 1;
buf = g_malloc0 (buf_size + 1);
icalvalue_decode_ical_string (data, buf, buf_size);
} else if (attachment->prop) {
diff --git a/src/calendar/libedata-cal/e-cal-cache.c b/src/calendar/libedata-cal/e-cal-cache.c
index a91fec1d5..f0b779296 100644
--- a/src/calendar/libedata-cal/e-cal-cache.c
+++ b/src/calendar/libedata-cal/e-cal-cache.c
@@ -3419,7 +3419,7 @@ e_cal_cache_delete_attachments (ECalCache *cal_cache,
gsize buf_size;
gchar *buf;
- buf_size = strlen (url);
+ buf_size = strlen (url) + 1;
buf = g_malloc0 (buf_size + 1);
icalvalue_decode_ical_string (url, buf, buf_size);
diff --git a/src/calendar/libedata-cal/e-cal-meta-backend.c b/src/calendar/libedata-cal/e-cal-meta-backend.c
index fbd1e62d5..c7b4f6315 100644
--- a/src/calendar/libedata-cal/e-cal-meta-backend.c
+++ b/src/calendar/libedata-cal/e-cal-meta-backend.c
@@ -2601,7 +2601,7 @@ ecmb_add_attachment_uris (ECalComponent *comp,
gsize buf_size;
gchar *buf;
- buf_size = strlen (url);
+ buf_size = strlen (url) + 1;
buf = g_malloc0 (buf_size + 1);
icalvalue_decode_ical_string (url, buf, buf_size);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]