From b1e9d46bcc268712faa4e5744812c886e69f6999 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Mon, 31 Jul 2017 12:01:41 +0900 Subject: [PATCH] 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 --- src/lib/elementary/elm_code_line.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) 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);