Diffstat (limited to 'libetpan/src/data-types/mailstream_helper.c') (more/less context) (show whitespace changes)
-rw-r--r-- | libetpan/src/data-types/mailstream_helper.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libetpan/src/data-types/mailstream_helper.c b/libetpan/src/data-types/mailstream_helper.c index 2f0b9ae..f0ddf51 100644 --- a/libetpan/src/data-types/mailstream_helper.c +++ b/libetpan/src/data-types/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; } |