Commit Graph
7 Commits
Author SHA1 Message Date
Max KunzelmannandLukas Fleischer 343ba5bfdf Fix memory leak by freeing linked lists in recurrence rules
The function responsible for freeing a recurring appointment or event
did not free the linked lists contained in the `struct rpt` holding the
recurrence rules. This led to memory leaks if a user had recurring
appointments or events.

Found with ASAN.

Signed-off-by: Max Kunzelmann <max@mxzero.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2024-01-26 13:38:33 +01:00
Max KunzelmannandLukas Fleischer 81953ef75a Fix memory leak in keys initialization
Previous to this commit, a strdup took place for every key name
including those that were replaced with customized key names later on
while never calling free on the pointer returned by strdup.

This fix only calls strdup for key names that are not replaced with
custom key names.

Found with ASAN.

Signed-off-by: Max Kunzelmann <max@mxzero.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2024-01-26 13:38:32 +01:00
Max KunzelmannandLukas Fleischer aa5ff07b61 Fix out of bounds memory access (off by one)
If fgets reads a line that only contains a `\n`, then the pointer `eol`
will point to the first byte in that buffer. The subsequent dereference
of `*(eol -1 )` will access the byte before that buffer.

This fix makes sure that that length of the current line read by fgets
is at least 2 bytes long.

Signed-off-by: Max Kunzelmann <max@mxzero.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2023-12-14 13:17:24 +01:00
MaxandLukas Fleischer f6090c7e17 add missing call to va_end() for copied va_list
The man page stdarg(3) states that each invocation of `va_copy()` must
be matched by a corresponding invocation of `va_end()` in the same
function.

Signed-off-by: Max <max@mxzero.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2023-11-06 15:42:59 -05:00
MaxandLukas Fleischer daa7da0d0b correctness: kill returns -1 on error
Signed-off-by: Max <max@mxzero.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2023-11-06 15:42:59 -05:00
MaxandLukas Fleischer b9a0719117 remove unnecessary set of sidebar width
When the function is called, `col` is zero, which leads to setting the
sidebar width (in percent) to zero. As the variable holding the
percentage is `static unsigned sbarwidth_perc` it is initialized to zero
anyway and we set the percentage later to the value loaded from the
configuration, too.

Signed-off-by: Max <max@mxzero.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2023-11-06 15:42:59 -05:00
MaxandLukas Fleischer d4eb9f85d0 Remove new line character from result of password command
For example, using `pass caldav` as `PasswordCommand` returns the
password for the account including a newline character at the end
because the whole output is captured. This fix removes the new line
character at the end of the line while keeping other whitespace
character should the password contain any at the end.

Signed-off-by: Max <max@mxzero.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2023-11-06 15:42:59 -05:00