[net.bugs] MH.6 bug

tim@ccice5.UUCP (Timothy G. Becker) (01/11/86)

I'm running MH.6 on a 4.2bsd system.

When are holes in the msg list (because rmm'd msgs), scan would
sometimes complain about not being able to open one of these nonexistant
msgs.  In one case, "folder -pack" complained and quit after trying to
compact the msg list.

Below is the fix to sbr/m_gmsg.c
=============================================================================

*** /tmp/,RCSt1004632	Fri Jan 10 15:44:19 1986 (old)
--- /tmp/,RCSt2004632	Fri Jan 10 15:44:22 1986 (new)
***************
*** 186,191
      if (mp -> msgstats < 0)
  	adios (NULLCP, "m_gmsg() botch -- you lose big");
  #endif	MTR
      for (tail = head; tail < rover; tail++)
  	mp -> msgstats[tail -> msgno] = tail -> stats;
      m_getatr (mp);

--- 186,198 -----
      if (mp -> msgstats < 0)
  	adios (NULLCP, "m_gmsg() botch -- you lose big");
  #endif	MTR
+ 
+     /* clear msgstats since realloc() doesn't clear the memory it
+        allocates.  without this, some nonexistant msgno's have valid
+        looking msgstats. */
+     for (i=0;i<mp->hghmsg;++i)
+         mp->msgstats[i] = 0;
+ 
      for (tail = head; tail < rover; tail++)
  	mp -> msgstats[tail -> msgno] = tail -> stats;
      m_getatr (mp);


Tim Becker.
..!{seismo,allegra,decvax}!rochester!ccice5!tim