summaryrefslogtreecommitdiffstats
path: root/mbox.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2017-03-02 14:53:20 -0800
committerKevin McCarthy <kevin@8t8.us>2017-03-02 14:53:20 -0800
commit786aa6cf32f8ad76a415b8418c0704c8ee65f676 (patch)
tree724eb3fdecef23f65ccd5807e0b5a2b075195e1e /mbox.c
parentde5ce9f7581d48282f0e304d95134b3ee817b890 (diff)
Prevent segv if open-appending to an mbox fails. (closes #3918)
If mbox_open_mailbox_append() fails, ctx->fp will be null. Add a check in mbox_close_mailbox(), to prevent a segv from passing null to fileno().
Diffstat (limited to 'mbox.c')
-rw-r--r--mbox.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mbox.c b/mbox.c
index 74affebc..57d58b70 100644
--- a/mbox.c
+++ b/mbox.c
@@ -465,7 +465,7 @@ static int mbox_open_mailbox_append (CONTEXT *ctx, int flags)
static int mbox_close_mailbox (CONTEXT *ctx)
{
- if (ctx->append)
+ if (ctx->append && ctx->fp)
{
mx_unlock_file (ctx->path, fileno (ctx->fp), 1);
mutt_unblock_signals ();