[tpop3d-discuss]Re: [PATCH] mailspool_load_index() has an off by one while indexing.

Chris Lightfoot chris at ex-parrot.com
Tue, 24 Jan 2006 17:25:46 +0000


On Tue, Jan 24, 2006 at 06:15:44PM +0100, Martin Blapp wrote:
> 
> 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.

ok, I've applied that, but I'd be interested to see an
example that triggers the problem -- I've never seen that.

-- 
``The jawbone of an ass is just as dangerous
  a weapon today as in Samson's time.'' (Richard Nixon)