imclient >4k literal error

Patrick Welche prlw1 at newn.cam.ac.uk
Sun Apr 6 16:58:30 EDT 2003


On Wed, Apr 02, 2003 at 01:28:06PM -0500, Rob Siemborski wrote:
> See Also:
> 
> http://bugzilla.andrew.cmu.edu/show_bug.cgi?id=333
> 
> In practice, not many applications use libcyrus for reading email, the
> closest we generally see is for small things like cyradm.  So there hasn't
> been pressure to fix it.

The following fixes this bug. The bug report also mentions
"we need to fix it so that literals that don't end lines are still handled
correctly." however RFC 2060 states that:

   The protocol receiver of an IMAP4rev1 client or server is either
   reading a line, or is reading a sequence of octets with a known
   count followed by a line.

so it seems that literals must be followed by a line according to the
protocol specification.

Cheers,

Patrick

Index: imclient.c
===================================================================
RCS file: /cvs/src/cyrus/lib/imclient.c,v
retrieving revision 1.77
diff -u -r1.77 imclient.c
--- imclient.c	13 Feb 2003 20:15:40 -0000	1.77
+++ imclient.c	6 Apr 2003 20:51:56 -0000
@@ -738,15 +743,13 @@
     while (parsed < imclient->replylen) {
 	/* If we're reading a literal, skip over it. */
 	if (imclient->replyliteralleft) {
-	    if (plainlen > imclient->replyliteralleft) {
-		plainlen -= imclient->replyliteralleft;
+	    if (imclient->replylen-parsed > imclient->replyliteralleft) {
 		parsed += imclient->replyliteralleft;
 		imclient->replyliteralleft = 0;
 		continue;
 	    }
 	    else {
-		parsed += plainlen;
-		imclient->replyliteralleft -= plainlen;
+		imclient->replyliteralleft -= (imclient->replylen-parsed);
 		return;
 	    }
 	}




More information about the Info-cyrus mailing list