lfos / calcurse

A text-based calendar and scheduling application
https://calcurse.org
BSD 2-Clause "Simplified" License
963 stars 95 forks source link

Segfault at first note encountered when using -G #450

Closed slackhead closed 1 year ago

slackhead commented 1 year ago

I emailed a patch for this but for some reason I can't reproduce this now. Perhaps garbage collecting might have been involved too. The fix might still be worth looking at though. Sorry this is a bit of a useless bug report!

Version 4.8.0

When using calcurse (-c /path/to/apts) -G, there is a segfault when the first note is encountered. This seems to be because src/ical.c tries to fclose(fp) even if fopen(note_file, "r") failed so fp isn't pointing to a file.

To reproduce:

"calcurse -G" with some notes

(Note I was also using -c when I encountered this)

The fix I found was to edit src/ical.c at line 216 (Patch attached) 0000-Don-t-fclose-fp-if-it-failed-to-fopen.patch.txt

lfos commented 1 year ago

Fixed via 4cd300f (Check that note files open before reading them, 2022-08-11), thanks for reporting and submitting a patch!