Skip to content

Commit 1babb1b

Browse files
committed
FLTK: fix memory access error
1 parent 784b496 commit 1babb1b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/platform/fltk/BasicEditor.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@ void BasicEditor::styleParse(const char *text, char *style, int length) {
177177
const char *temp;
178178
int searchLen = strlen(_search);
179179

180-
for (; length > 0; length--, text++) {
180+
for (int index = 0; length > 0; length--, text++, index++) {
181181
if (current == PLAIN) {
182182
// check for directives, comments, strings, and keywords
183-
if ((*text == '#' && (*(text - 1) == 0 || *(text - 1) == 10)) ||
183+
if ((*text == '#' && (index == 0 || *(text - 1) == 0 || *(text - 1) == 10)) ||
184184
(strncasecmp(text, "rem", 3) == 0 && text[3] == ' ') || *text == '\'') {
185185
// basic comment
186186
current = COMMENTS;

0 commit comments

Comments
 (0)