From 2dab76f280e5696ebaf3d861aa70d78423d434e4 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 14 Apr 2014 15:36:31 +1000 Subject: Fix write one past array end bug. --- lexers/LexCPP.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lexers') diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index 99f598722..5bcd0b4df 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -86,10 +86,11 @@ static bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) { static void highlightTaskMarker(StyleContext &sc, LexAccessor &styler, int activity, WordList &markerList, bool caseSensitive){ if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) { - char marker[50]; + const int lengthMarker = 50; + char marker[lengthMarker+1]; int currPos = (int) sc.currentPos; int i = 0; - while (i < 50) { + while (i < lengthMarker) { char ch = styler.SafeGetCharAt(currPos + i); if (IsASpace(ch) || isoperator(ch)) { break; -- cgit v1.2.3