elm code - handle alloc failure for line split

this culd optentially use large offsets before accessing the ptr thus
it may not segv inthe first page but actually work if positionoffsets
are large enouh, so handle this case explicitly.

@fix

found by PVS studio
This commit is contained in:
Carsten Haitzler 2017-07-31 12:01:41 +09:00
parent d639063b50
commit b1e9d46bcc
1 changed files with 1 additions and 1 deletions

View File

@ -70,7 +70,7 @@ EAPI void elm_code_line_split_at(Elm_Code_Line *line, unsigned int position)
content = (char *) elm_code_line_text_get(line, &length);
if (!content) return;
content = strndup(content, length);
content = strndup(content, length);
if (!content) return;
elm_code_file_line_insert(line->file, line->number + 1, "", 0, NULL);
newline = elm_code_file_line_get(line->file, line->number + 1);