From: Hugo Villeneuve Date: Tue, 28 Jun 2005 02:25:31 +0000 (+0000) Subject: Fixed bug when response is broken into multiple packets X-Git-Tag: v0.3.2~13 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=cd1b3197233f4dfac3784e2fe4161992015d22e6;p=dockapps%2Fwmnotify.git Fixed bug when response is broken into multiple packets There was an error after the last line in the buffer (first part of the response) was processed, which generated a NULL stringp --- diff --git a/src/imap.c b/src/imap.c index 798d5b6..3fc2e4f 100644 --- a/src/imap.c +++ b/src/imap.c @@ -120,12 +120,19 @@ IMAP4_ReceiveResponse( void ) /* In case no delimiter was found, the token is taken to be the entire string *stringp, and *stringp is made NULL. */ if( stringp == NULL ) { - /* This should never happen. */ - ErrorLocation( __FILE__, __LINE__ ); - fprintf( stderr, " Delimiter not found in strsep() call.\n" ); - goto error; + if( token[0] == '\0' ) { + /* This means we finished parsing the last line of the buffer, but we need to + get more data to continue process the next part of the IMAP4 response. */ + goto get_packet; + } + else { + /* This should never happen. */ + ErrorLocation( __FILE__, __LINE__ ); + fprintf( stderr, " Delimiter not found in strsep() call.\n" ); + goto error; + } } - + if( token == NULL ) { /* This should never happen. */ ErrorLocation( __FILE__, __LINE__ );