summaryrefslogtreecommitdiffabout
path: root/libetpan/src/data-types/mailstream_helper.c
Side-by-side diff
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.c9
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
@@ -98,10 +98,17 @@ char * mailstream_read_line_append(mailstream * stream, MMAPString * line)
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;