commit ec2333b902f98d5e917994af8a7ff1ef3c1bdf3a
parent 109fb63a71e7a5a4689f7fe93917b92aa2064ea1
Author: Paul <paul@claws-mail.org>
Date: Tue, 12 Sep 2023 11:11:21 +0100
fix bug 4637, 'Segmentation fault when using SUMMARY is empty'
Diffstat:
2 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/src/plugins/vcalendar/vcal_folder.c b/src/plugins/vcalendar/vcal_folder.c
@@ -1,7 +1,6 @@
/*
* Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2022 Colin Leroy <colin@colino.net> and
- * the Claws Mail team
+ * Copyright (C) 1999-2023 the Claws Mail team and Colin Leroy <colin@colino.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1470,14 +1469,13 @@ gchar* get_item_event_list_for_date(FolderItem *item, EventTime date)
if (days != date)
continue;
prop = icalcomponent_get_first_property((icalcomponent *)fdata->event, ICAL_SUMMARY_PROPERTY);
- if (prop) {
- if (!g_utf8_validate(icalproperty_get_summary(prop), -1, NULL))
- summary = conv_codeset_strdup(icalproperty_get_summary(prop),
+ summary = g_strdup(icalproperty_get_summary(prop));
+ if (summary) {
+ if (!g_utf8_validate(summary, -1, NULL))
+ summary = conv_codeset_strdup(summary,
conv_get_locale_charset_str(), CS_UTF_8);
- else
- summary = g_strdup(icalproperty_get_summary(prop));
} else
- summary = g_strdup("-");
+ summary = g_strdup(_("[no summary]"));
strs = g_slist_prepend(strs, summary);
}
diff --git a/src/plugins/vcalendar/vcal_manager.c b/src/plugins/vcalendar/vcal_manager.c
@@ -1,7 +1,6 @@
/*
* Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2017 Colin Leroy <colin@colino.net> and
- * the Claws Mail team
+ * Copyright (C) 1999-2023 the Claws Mail team and Colin Leroy <colin@colino.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1330,12 +1329,10 @@ static gchar *write_headers_ical(PrefsAccount *account,
memset(date, 0, sizeof(date));
prop = icalcomponent_get_first_property(ievent, ICAL_SUMMARY_PROPERTY);
- if (prop) {
- summary = g_strdup(icalproperty_get_summary(prop));
- icalproperty_free(prop);
- } else {
- summary = g_strdup("");
- }
+ summary = g_strdup(icalproperty_get_summary(prop));
+ icalproperty_free(prop);
+ if (!summary)
+ summary = g_strdup(_("[no summary]"));
while (strchr(summary, '\n'))
*(strchr(summary, '\n')) = ' ';