From daf87093f85972fc595560a3ac8537b6c74e01b0 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Mon, 3 Jul 2017 16:22:01 +0900 Subject: [PATCH] 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. --- src/lib/eina/eina_file_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c index 4b94d1d20c..8d7472bdd3 100644 --- a/src/lib/eina/eina_file_common.c +++ b/src/lib/eina/eina_file_common.c @@ -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;