eina file: Fix rare crash in line iteration

I'm not sure about the rest of this code, so it's possible that
the index is increased even if it shouldn't. But I've observed
a crash at this line, apparently when reaching the end pointer.
This commit is contained in:
Jean-Philippe Andre 2017-07-03 16:22:01 +09:00
parent 8906867500
commit daf87093f8
1 changed files with 2 additions and 2 deletions

View File

@ -606,8 +606,8 @@ _eina_file_map_lines_iterator_next(Eina_Lines_Iterator *it, void **data)
match = *it->current.end;
if (it->current.index > 0)
it->current.end++;
while ((*it->current.end == '\n' || *it->current.end == '\r')
&& it->current.end < it->end)
while (it->current.end < it->end &&
(*it->current.end == '\n' || *it->current.end == '\r'))
{
if (match == *it->current.end)
break;