From 2003a6950166d8e470d71e4e07ef9bbf4bc35ccd Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 17 Oct 2000 02:38:18 +0000 Subject: Don't free 'resp' as it doesn't point to the beginning of the allocated 2000-10-16 Jeffrey Stedfast * providers/imap/camel-imap-command.c (camel_imap_response_extract): Don't free 'resp' as it doesn't point to the beginning of the allocated data, instead free response->untagged->pdata[i]. Also, if '*resp' is equal to a space character, then set resp = imap_next_word (resp) rather than expecting resp++ to work (there's a list broken IMAP daemons that like to put extra spaces between tokens). (imap_read_response): Don't expect 'respbuf+2' to be where the untagged number response to start (see above fix for an explanation). svn path=/trunk/; revision=5960 --- camel/ChangeLog | 19 +++++++++++++++---- camel/providers/imap/camel-imap-command.c | 21 +++++++++++---------- 2 files changed, 26 insertions(+), 14 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index 1928d9192b..2bd58ffd64 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,16 @@ +2000-10-16 Jeffrey Stedfast + + * providers/imap/camel-imap-command.c + (camel_imap_response_extract): Don't free 'resp' as it doesn't + point to the beginning of the allocated data, instead free + response->untagged->pdata[i]. Also, if '*resp' is equal to a space + character, then set resp = imap_next_word (resp) rather than + expecting resp++ to work (there's a list broken IMAP daemons that + like to put extra spaces between tokens). + (imap_read_response): Don't expect 'respbuf+2' to be where the + untagged number response to start (see above fix for an + explanation). + 2000-10-16 Chris Toshok * camel-service.c (get_path): when using the construct (flags & @@ -92,8 +105,7 @@ Fix camel_summary_* function rename (imap_get_message_info_internal): Likewise. - * camel-mime-parser.c (camel_mime_parser_finalise): Fixed a - spelling mistake. + * camel-mime-parser.c (camel_mime_parser_finalise): Fixed a spelling mistake. * camel-folder-summary.c (camel_summary_format_address): Uh, why do we encode and then decode here ... sigh. This is not the way @@ -105,8 +117,7 @@ 2000-10-11 Chris Toshok - * providers/nntp/camel-nntp-store.c - (nntp_store_unsubscribe_folder): remove the leading '/'. + * providers/nntp/camel-nntp-store.c (nntp_store_unsubscribe_folder): remove the leading '/'. (nntp_store_subscribe_folder): same. (nntp_store_folder_subscribed): same. diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c index 7a6045d16d..1827869c14 100644 --- a/camel/providers/imap/camel-imap-command.c +++ b/camel/providers/imap/camel-imap-command.c @@ -134,7 +134,7 @@ imap_read_response (CamelImapStore *store, CamelException *ex) CamelImapResponse *response; int number, exists = 0; GArray *expunged = NULL; - char *respbuf, *retcode, *p; + char *respbuf, *retcode, *word, *p; /* Read first line */ if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (store), @@ -154,14 +154,15 @@ imap_read_response (CamelImapStore *store, CamelException *ex) /* If it starts with a number, we might deal with * it ourselves. */ - number = strtoul (respbuf + 2, &p, 10); - if (p != respbuf + 2 && store->current_folder) { - p = imap_next_word (p); - if (!g_strcasecmp (p, "EXISTS")) { + word = imap_next_word (respbuf + 2); + number = strtoul (word, &p, 10); + if (p != word && store->current_folder) { + word = imap_next_word (p); + if (!g_strcasecmp (word, "EXISTS")) { exists = number; g_free (respbuf); goto next; - } else if (!g_strcasecmp (p, "EXPUNGE")) { + } else if (!g_strcasecmp (word, "EXPUNGE")) { if (!expunged) { expunged = g_array_new (FALSE, FALSE, sizeof (int)); @@ -171,8 +172,7 @@ imap_read_response (CamelImapStore *store, CamelException *ex) goto next; } } else { - p = imap_next_word (respbuf); - if (!g_strncasecmp (p, "BYE", 3)) { + if (!g_strncasecmp (word, "BYE", 3)) { /* connection was lost, no more data to fetch */ store->connected = FALSE; g_free (respbuf); @@ -349,11 +349,12 @@ camel_imap_response_extract (CamelImapResponse *response, const char *type, /* Skip "* ", and initial sequence number, if present */ strtoul (resp + 2, &resp, 10); if (*resp == ' ') - resp++; + resp = imap_next_word (resp); if (!g_strncasecmp (resp, type, len)) break; - g_free (resp); + + g_free (response->untagged->pdata[i]); } if (i < response->untagged->len) { -- cgit v1.2.3