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
This commit is contained in:
YeongJong Lee 2017-01-13 11:38:26 +00:00 committed by Andy Williams
parent 63e6376697
commit 1c3474245a
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}