From: markus schnalke Date: Fri, 3 Feb 2012 09:42:49 +0000 (+0100) Subject: Fixed abort of e.g. comp when draft folder is empty. X-Git-Tag: mmh-thesis-end~380 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=0b81a300d9e7cf78b6bc11d8c870f57fa81fcdc4;p=mmh 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. --- 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); }