From 0b81a300d9e7cf78b6bc11d8c870f57fa81fcdc4 Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Fri, 3 Feb 2012 10:42:49 +0100 Subject: [PATCH] Fixed abort of e.g. comp when draft folder is empty. In this case mp->lowoff is 1 but mp->lowmsg equal mp->hghmsg equal 0. Hence we have an access at mp->msgstats[-1], which corrupted our mem. Gdb hadn't helped me for this, but valgrind showed me the problem. --- sbr/seq_add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbr/seq_add.c b/sbr/seq_add.c index 5d0987c..6c99b5d 100644 --- a/sbr/seq_add.c +++ b/sbr/seq_add.c @@ -156,7 +156,7 @@ seq_addmsg(struct msgs *mp, char *cp, int msgnum, int public, int zero) ** If sequence is new, or zero flag is set, then first ** clear the bit for this sequence from all messages. */ - if (new_seq || zero) { + if (mp->nummsg>0 && (new_seq || zero)) { for (j = mp->lowmsg; j <= mp->hghmsg; j++) clear_sequence(mp, i, j); } -- 1.7.10.4