changeset: 6954:e3e47b2f1370
user:      Kevin McCarthy <ke...@8t8.us>
date:      Thu Mar 02 14:53:20 2017 -0800
link:      http://dev.mutt.org/hg/mutt/rev/e3e47b2f1370

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().

changeset: 6955:9ede6c95d3d5
user:      Kevin McCarthy <ke...@8t8.us>
date:      Thu Mar 02 14:58:27 2017 -0800
link:      http://dev.mutt.org/hg/mutt/rev/9ede6c95d3d5

merge stable

diffs (12 lines):

diff -r e82253beaa9f -r 9ede6c95d3d5 mbox.c
--- a/mbox.c    Thu Mar 02 13:11:52 2017 -0800
+++ b/mbox.c    Thu Mar 02 14:58:27 2017 -0800
@@ -465,7 +465,7 @@
 
 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 ();

Reply via email to