[tpop3d-discuss][PATCH] mailspool_load_index() has an off by one while indexing.
Martin Blapp
mb at imp.ch
Tue, 24 Jan 2006 18:15:44 +0100 (CET)
mailspool_load_index() doesn't reduce m->num by one if !feof(fp).
This can result in an always broken indexfile and segfaults afterwords.
--- mailspool.c.orig Tue Jan 24 14:21:10 2006
+++ mailspool.c Tue Jan 24 18:06:32 2006
@@ -960,6 +960,16 @@
}
if (!feof(fp)) {
+
+ --m->num;
+
log_print(LOG_WARNING, _("mailspool_load_index(%s): index exists, but
has some stale or corrupt data"), indexfile);
goto fail;
}
I have examples here.
Thanks for fixing !
Martin
Martin Blapp, <mb@imp.ch> <mbr@FreeBSD.org>
------------------------------------------------------------------
ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH
Phone: +41 61 826 93 00 Fax: +41 61 826 93 01
PGP: <finger -l mbr@freebsd.org>
PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E
------------------------------------------------------------------