-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 | |||
@@ -98,10 +98,17 @@ char * mailstream_read_line_append(mailstream * stream, MMAPString * line) | |||
98 | if (r == -1) | 98 | if (r == -1) |
99 | return NULL; | 99 | return NULL; |
100 | 100 | ||
101 | if (r == 0) | 101 | if (r == 0) { |
102 | // LR | ||
103 | // this avoids a memory access violation later when trying | ||
104 | // to remove_trailing_eol from a null string | ||
105 | if ( line->len == 0 ) | ||
106 | return NULL; | ||
107 | else | ||
102 | break; | 108 | break; |
103 | } | 109 | } |
104 | } | 110 | } |
111 | } | ||
105 | while (1); | 112 | while (1); |
106 | 113 | ||
107 | return line->str; | 114 | return line->str; |