Fix out-of-bounds error when incorporating email from stdin
authorDmitry Bogatov <KAction@gnu.org>
Fri, 26 Aug 2016 23:03:28 +0000 (02:03 +0300)
committerPhilipp Takacs <philipp@bureaucracy.de>
Sat, 27 Aug 2016 21:14:30 +0000 (23:14 +0200)
commit88b2142594d5ea1e8385dae5eca81eed1018c555
tree33c7f30dbb4bf2bef6b01cd1ba07eeebce23f050
parent3ba0e8cc826b51f7d8e2d1e3e04557857d13f334
Fix out-of-bounds error when incorporating email from stdin

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 <KAction@gnu.org>
sbr/seq_setunseen.c
test/tests/inc/test-read-stdin