summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-31 12:01:41 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-31 12:01:41 +0900
commitb1e9d46bcc268712faa4e5744812c886e69f6999 (patch)
treef090781b84ed18f74ebe93d8aabf43a436646179
parentd639063b507b3339095edb3c0b685c03b1b293fd (diff)
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
-rw-r--r--src/lib/elementary/elm_code_line.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/elementary/elm_code_line.c b/src/lib/elementary/elm_code_line.c
index 3d5cc2f7be..fd222a3d4e 100644
--- a/src/lib/elementary/elm_code_line.c
+++ b/src/lib/elementary/elm_code_line.c
@@ -70,7 +70,7 @@ EAPI void elm_code_line_split_at(Elm_Code_Line *line, unsigned int position)
70 70
71 content = (char *) elm_code_line_text_get(line, &length); 71 content = (char *) elm_code_line_text_get(line, &length);
72 if (!content) return; 72 if (!content) return;
73 content = strndup(content, length); 73 content = strndup(content, length);
74 if (!content) return; 74 if (!content) return;
75 elm_code_file_line_insert(line->file, line->number + 1, "", 0, NULL); 75 elm_code_file_line_insert(line->file, line->number + 1, "", 0, NULL);
76 newline = elm_code_file_line_get(line->file, line->number + 1); 76 newline = elm_code_file_line_get(line->file, line->number + 1);