Commit 7f838688 7f838688a2db76401452b970e2989e887422c6dc by Sergey Poznyakoff

(imap_literal_string): Bugfix. Literal length may be {0}.

1 parent 554040c8
...@@ -970,6 +970,14 @@ imap_literal_string (f_imap_t f_imap, char **ptr) ...@@ -970,6 +970,14 @@ imap_literal_string (f_imap_t f_imap, char **ptr)
970 size_t len, len0, total; 970 size_t len, len0, total;
971 int status = 0; 971 int status = 0;
972 int nl; 972 int nl;
973
974 if (f_imap->string.nleft==0)
975 {
976 status = imap_readline (f_imap);
977 *ptr = f_imap->buffer;
978 return status;
979 }
980
973 /* The (len + 1) in the for is to count the strip '\r' by imap_readline. */ 981 /* The (len + 1) in the for is to count the strip '\r' by imap_readline. */
974 for (len0 = len = total = 0; total < f_imap->string.nleft; total += (len + 1)) 982 for (len0 = len = total = 0; total < f_imap->string.nleft; total += (len + 1))
975 { 983 {
......