office/calcurse: Patch to avoid crash using -G.

Signed-off-by: bedlam <dave@slackbuilds.org>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Dave Woodfall 2023-01-28 04:11:11 +00:00 committed by Willy Sudiarto Raharjo
parent c8014943c1
commit 1e7e2617ca
No known key found for this signature in database
GPG key ID: 3F617144D7238786
2 changed files with 53 additions and 1 deletions

View file

@ -0,0 +1,50 @@
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(&note_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--

View file

@ -30,7 +30,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=calcurse
VERSION=${VERSION:-4.8.0}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -83,6 +83,8 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
patch -p1 <$CWD/0001-Don-t-fclose-fp-if-it-failed-to-fopen.patch
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \