[balsa] Fix long-line POP3 bug reported by Rob Landley.
- From: Pawel Salek <pawels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] Fix long-line POP3 bug reported by Rob Landley.
- Date: Mon, 22 Oct 2012 20:41:18 +0000 (UTC)
commit b66dedcaa5adb687dd29b6fd35549250ec459893
Author: Pawel Salek <pawsa0 gmail com>
Date: Mon Oct 22 22:36:31 2012 +0200
Fix long-line POP3 bug reported by Rob Landley.
Conflicts:
ChangeLog
ChangeLog | 4 ++++
libbalsa/imap/pop3.c | 12 ++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 74313ad..144ea41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-10-22 Pawel Salek
+
+ * libbalsa/imap/pop3.c: fix long-line POP3 bug reported by Rob Landley.
+
2012-09-17 Peter Bloomfield
Fix bgo #684124
diff --git a/libbalsa/imap/pop3.c b/libbalsa/imap/pop3.c
index dbe5222..208bde6 100644
--- a/libbalsa/imap/pop3.c
+++ b/libbalsa/imap/pop3.c
@@ -634,10 +634,14 @@ pop_fetch_message_s(PopHandle *pop, unsigned msgno,
resp = pop_check_status(pop, err);
/* do here the fetch */
if(resp) {
+ /* whether next line will be a continuation line. */
+ gboolean continuation_line = FALSE;
while( sio_gets(pop->sio, line, sizeof(line)) &&
- strcmp(line, ".\r\n") ) {
+ (continuation_line || strcmp(line, ".\r\n")) ) {
char *arg = line[0] == '.' ? line+1 : line;
unsigned len = strlen(arg);
+ continuation_line = (len >= POP_LINE_LEN-1);
+ printf("Line '%s'\n", line);
if(pop->filter_cr && len>=2 && arg[len-2] == '\r')
arg[(--len)-1] = '\n';
if(resp)
@@ -647,6 +651,7 @@ pop_fetch_message_s(PopHandle *pop, unsigned msgno,
resp = FALSE;
}
}
+ printf("LAST Line is '%s'\n", line);
}
return resp;
}
@@ -727,10 +732,13 @@ pop_complete_retr(PopHandle *pop, PopAsyncCb cb, void *arg)
cb(rc, arg, &err);
if(resp) { /* same code as in fetch_message() */
char * str;
+ /* whether next line will be a continuation line. */
+ gboolean continuation_line = FALSE;
while( (str = sio_gets(pop->sio, line, sizeof(line))) &&
- strcmp(line, ".\r\n") ) {
+ (continuation_line || strcmp(line, ".\r\n")) ) {
char *buf = line[0] == '.' ? line+1 : line;
unsigned len = strlen(buf);
+ continuation_line = (len >= POP_LINE_LEN-1);
if(pop->filter_cr && len>=2 && buf[len-2] == '\r')
buf[(--len)-1] = '\n';
if(cb)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]