diff options
author | Kevin McCarthy <kevin@8t8.us> | 2021-03-16 14:56:13 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2021-03-19 14:30:07 -0700 |
commit | 8eb29a4c78ccb56bcb9889e360c32a108430cf7a (patch) | |
tree | 6a4a8bfd7811b0878892857c52f156f733717179 /main.c | |
parent | dcf1d11f0eaed0aa42dcea3b41a5171ffd04d245 (diff) |
Check if mutt_prepare_template() fails for -H command line arg.
If the function fails, it will free the envelope, leading to a segv
just below.
Thanks to Phil Pennock for reporting the problem.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -1126,7 +1126,21 @@ int main (int argc, char **argv, char **environ) } context_hdr->content->length = st.st_size; - mutt_prepare_template (fin, NULL, msg, context_hdr, 0); + if (mutt_prepare_template (fin, NULL, msg, context_hdr, 0) < 0) + { + if (!option (OPTNOCURSES)) + { + mutt_endwin (NULL); + set_option (OPTNOCURSES); + } + /* L10N: + Error when using -H command line argument, but reading the draft + file fails for some reason. + */ + fputs (_("Cannot parse draft file\n"), stderr); + goto cleanup_and_exit; + } + /* Scan for mutt header to set OPTRESUMEDRAFTFILES */ for (last_uhp = &msg->env->userhdrs, uh = *last_uhp; |