[PATCH] imapd segfaults after broken pipe

Henrique de Moraes Holschuh hmh at debian.org
Sun Jan 5 11:05:49 EST 2003


On Sun, 05 Jan 2003, Gerd v. Egidy wrote:
> > The attached patch fixes this.

Looking through the code, it looks like it must never happen for cnt to be
zero outside of prot_*, for write streams.

IMHO proper asserts should be added to the #define macros to guard against
this (it looks like there is at least one bug somewhere that violates that
assumption), the same way their function counterparts do.

As for prot_flush, it looks buggy.  It does not clean up after itself on
failures (such as getting a sigpipe or whatever) in a way to make sure it
will NEVER exit with the write buffer full (cnt = 0).

I am still not 100% sure of my accessment of the situation: I am still
reading through the code, so I may be completely wrong about the issue.

I am *really* not sure about adding the s->error and s->eof tests, though.
Are you sure they belong there? (I need to better grasp the workings of
prot.* before I answer that myself).

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh




More information about the Info-cyrus mailing list