mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-16 19:50:19 +01:00
1e7e2617ca
Signed-off-by: bedlam <dave@slackbuilds.org> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
50 lines
1.4 KiB
Diff
50 lines
1.4 KiB
Diff
From dc63cf73781f9303ed1f12dc7e4ecfb6f3938f3c Mon Sep 17 00:00:00 2001
|
|
From: dave <dave@slackbuilds.org>
|
|
Date: Sat, 28 Jan 2023 01:51:55 +0000
|
|
Subject: [PATCH] Don't fclose(fp) if it failed to fopen()
|
|
MIME-Version: 1.0
|
|
Content-Type: multipart/mixed; boundary="------------true"
|
|
|
|
This is a multi-part message in MIME format.
|
|
--------------true
|
|
Content-Type: text/plain; charset=UTF-8; format=fixed
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
|
|
This fixes a segfault in fclose@@GLIBC_2.2.5
|
|
'calcurse -c /path/to/apts -G' segfaults at first note seen.
|
|
Split the tests @ ical.c:216 into two:
|
|
return if fopen(fp) failed.
|
|
fclose(fp) and return @ EOF.
|
|
|
|
Signed-off-by: dave <dave@slackbuilds.org>
|
|
---
|
|
src/ical.c | 5 ++++-
|
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
|
|
--------------true
|
|
Content-Type: text/x-patch; name="0001-Don-t-fclose-fp-if-it-failed-to-fopen.patch"
|
|
Content-Transfer-Encoding: 8bit
|
|
Content-Disposition: attachment; filename="0001-Don-t-fclose-fp-if-it-failed-to-fopen.patch"
|
|
|
|
diff --git a/src/ical.c b/src/ical.c
|
|
index 535bca8..4b55343 100644
|
|
--- a/src/ical.c
|
|
+++ b/src/ical.c
|
|
@@ -213,7 +213,10 @@ static void ical_export_note(FILE *stream, char *name)
|
|
int has_desc, has_prop, i;
|
|
|
|
asprintf(¬e_file, "%s/%s", path_notes, name);
|
|
- if (!(fp = fopen(note_file, "r")) || ungetc(getc(fp), fp) == EOF) {
|
|
+ if (!(fp = fopen(note_file, "r"))) {
|
|
+ return;
|
|
+ }
|
|
+ if (ungetc(getc(fp), fp) == EOF) {
|
|
fclose(fp);
|
|
return;
|
|
}
|
|
|
|
--------------true--
|
|
|
|
|