forked from enlightenment/efl
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:
parent
6e82f90807
commit
d639063b50
|
@ -68,8 +68,10 @@ EAPI void elm_code_line_split_at(Elm_Code_Line *line, unsigned int position)
|
|||
char *content;
|
||||
unsigned int length;
|
||||
|
||||
content = (char *) elm_code_line_text_get(line, &length);
|
||||
content = strndup(content, length);
|
||||
content = (char *) elm_code_line_text_get(line, &length);
|
||||
if (!content) return;
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue