ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/tools/edi.git/commit/?id=1c3474245a70548ec3a3993dac963fd7d8e0687e

commit 1c3474245a70548ec3a3993dac963fd7d8e0687e
Author: YeongJong Lee <clean...@naver.com>
Date:   Fri Jan 13 11:38:26 2017 +0000

    autosuggest: Fix segment fault when type long word
    
    Summary:
    It need a space more for adding a charater.
    e.g. line 434..
    
    Test Plan:
    1. open suggest list in code file using <Ctrl> + <Space>.
    2. type some long word.
    e.g. 'evas_object_smart_callback_add'
    3. Check there is no segment fault.
    
    Reviewers: ajwillia.ms
    
    Differential Revision: https://phab.enlightenment.org/D4562
---
 src/bin/editor/edi_editor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/bin/editor/edi_editor.c b/src/bin/editor/edi_editor.c
index 23096b8..a7132c3 100644
--- a/src/bin/editor/edi_editor.c
+++ b/src/bin/editor/edi_editor.c
@@ -92,10 +92,10 @@ _edi_editor_current_word_get(Edi_Editor *editor, unsigned 
int row, unsigned int
           *(ptr - 1) == '_'))
      ptr--;
 
-   wordlen = col - (ptr - curtext) - 1;
+   wordlen = col - (ptr - curtext);
    curword = malloc(sizeof(char) * (wordlen + 1));
    strncpy(curword, ptr, wordlen);
-   curword[wordlen] = '\0';
+   curword[wordlen - 1] = '\0';
 
    return curword;
 }

-- 


Reply via email to