aports/community/calcurse/0001-Fix-segfault-when-importing-iCal-files.patch
Marian Buschsieweke fb4a0eb258 community/calcurse: fix segfault on importing iCal files
This adds a quick fix to fix a segfault when importing iCal files with
events / appointments that contain no description.

In addition, a -dbg subpkg is provided to ease future bug fixing.
2023-04-05 21:53:58 +02:00

40 lines
1.2 KiB
Diff

Patch-Source: https://github.com/lfos/calcurse/pull/454
--
From 73ba94fa8d50a8de772d2254f7b5a4327058066c Mon Sep 17 00:00:00 2001
From: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Date: Wed, 5 Apr 2023 14:03:07 +0200
Subject: [PATCH] Fix segfault when importing iCal files
Previously, events / appointments without a description resulted in
a segfault. This provides a trivial fix by adding an `<emtpy>` as
description in this case.
---
src/ical.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/ical.c b/src/ical.c
index 535bca8..14c9917 100644
--- a/src/ical.c
+++ b/src/ical.c
@@ -519,6 +519,8 @@ ical_store_event(char *mesg, char *note, time_t day, time_t end,
const int EVENTID = 1;
struct event *ev;
struct recur_event *rev;
+ mesg = (mesg != NULL) ? mesg : strdup("<empty>");
+ EXIT_IF(mesg == NULL, _("ical_store_event: out of memory"));
/*
* Repeating event. The end day is ignored, and the event becomes
@@ -571,6 +573,8 @@ ical_store_apoint(char *mesg, char *note, time_t start, long dur,
struct apoint *apt;
struct recur_apoint *rapt;
time_t day;
+ mesg = (mesg != NULL) ? mesg : strdup("<empty>");
+ EXIT_IF(mesg == NULL, _("ical_store_apoint: out of memory"));
if (has_alarm)
state |= APOINT_NOTIFY;
--
2.40.0