-rw-r--r-- | kmicromail/libetpan/tools/mailstream_helper.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kmicromail/libetpan/tools/mailstream_helper.c b/kmicromail/libetpan/tools/mailstream_helper.c index 146f955..92f4ffe 100644 --- a/kmicromail/libetpan/tools/mailstream_helper.c +++ b/kmicromail/libetpan/tools/mailstream_helper.c @@ -97,12 +97,19 @@ char * mailstream_read_line_append(mailstream * stream, MMAPString * line) r = mailstream_feed_read_buffer(stream); if (r == -1) return NULL; - if (r == 0) + if (r == 0) { + // LR + // this avoids a memory access violation later when trying + // to remove_trailing_eol from a null string + if ( line->len == 0 ) + return NULL; + else break; } } + } while (1); return line->str; } |