From: Dmitry Bogatov <kact...@gnu.org>

Before this patch, if +inbox is empty, following error happened:

        $ inc -file - < /dev/null

        Incorporating new mail into inbox...

        inc: no messages incorporated, continuing...
        inc: Bug: message out of bounds

This happened due improper call to `seq_setunseen', which implicitly
assumed that there is at least one message (it does not handle case
where both mp->hghmsg and mh->lowmsg are 0).

Bug does not happens with command `inc -file empty', since file
is checked for being empty before any read attempts.

Signed-off-by: Dmitry Bogatov <kact...@gnu.org>
---
 sbr/seq_setunseen.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sbr/seq_setunseen.c b/sbr/seq_setunseen.c
index d833650..bd57a2c 100644
--- a/sbr/seq_setunseen.c
+++ b/sbr/seq_setunseen.c
@@ -23,6 +23,10 @@ seq_setunseen(struct msgs *mp, int doadd)
        int n;
        char **ap, *cp, *dp;
 
+       if (mp->lowmsg == 0) {
+               return;
+       }
+
        /*
        ** Get the list of sequences for Unseen-Sequence
        ** and split them.
-- 
I may be not subscribed. Please, keep me in carbon copy.


Reply via email to