8 Aug 00:49
RE: patch: fix for rare smtp_close() crash
From: Mark Crispin <markrcrispin <at> live.com>
Subject: RE: patch: fix for rare smtp_close() crash
Newsgroups: gmane.mail.imap.uw.c-client
Date: 2008-08-07 22:49:33 GMT
Subject: RE: patch: fix for rare smtp_close() crash
Newsgroups: gmane.mail.imap.uw.c-client
Date: 2008-08-07 22:49:33 GMT
Thank you. Your proposed patch is correct, and is now in Panda IMAP. For what it's worth, there may be some news about a public distribution of Panda IMAP later this month. -- Mark -- http://panda.com/mrc Democracy is two wolves and a sheep deciding what to eat for lunch. Liberty is a well-armed sheep contesting the vote. > Date: Fri, 8 Aug 2008 00:31:00 +0200 > From: vz-cclient <at> zeitlins.org > To: imap-uw <at> u.washington.edu > Subject: [Imap-uw] patch: fix for rare smtp_close() crash > > Hello, > > Although Mark doesn't maintain the library any more, I hope this small > patch is still going to be useful to someone. It fixes a rare problem (but > which does happen as it just did do a user of my program) in smtp_close() > which reads like this in the latest version I have: > > if (stream) { /* send "QUIT" */ > if (stream->netstream) { /* do close actions if have netstream */ > smtp_send (stream,"QUIT",NIL); > net_close (stream->netstream); > } > ... > > The problem is that the connection could be lost inside smtp_send() in > which case netstream is reset to NIL in smtp_fake() and the call to > net_close() crashes. The following trivial patch fixes it: > > Index: lib/imap/src/c-client/smtp.c > =================================================================== > --- lib/imap/src/c-client/smtp.c (revision 7536) > +++ lib/imap/src/c-client/smtp.c (revision 7537) > @@ -396,7 +396,8 @@ > > if (stream) { /* send "QUIT" */ > if (stream->netstream) { /* do close actions if have netstream */ > smtp_send (stream,"QUIT",NIL); > - net_close (stream->netstream); > + if (stream->netstream) /* could have been closed during "QUIT" */ > + net_close (stream->netstream); > } > /* clean up */ > if (stream->host) fs_give ((void **) &stream->host); > > HTH, > VZ _________________________________________________________________ Got Game? Win Prizes in the Windows Live Hotmail Mobile Summer Games Trivia Contest http://www.gowindowslive.com/summergames?ocid=TXT_TAGHM_______________________________________________ Imap-uw mailing list Imap-uw <at> u.washington.edu http://mailman2.u.washington.edu/mailman/listinfo/imap-uw
RSS Feed