From bec2a01c474e70f13576dc77cc703115bef87dc3 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Mon, 2 Mar 2009 12:06:13 +0000 Subject: Bug #2648342 Bug in LexPerl string comparison fixed. --- src/LexPerl.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/LexPerl.cxx b/src/LexPerl.cxx index 4b7c9878a..4853460bf 100644 --- a/src/LexPerl.cxx +++ b/src/LexPerl.cxx @@ -247,8 +247,9 @@ static bool styleCheckSubPrototype(Accessor &styler, unsigned int bk) static bool isMatch(const char *sref, char *s) { // match per-line delimiter - must kill trailing CR if CRLF - if (s[strlen(s) - 1] == '\r') - s[strlen(s) - 1] = '\0'; + int i = strlen(s); + if (i != 0 && s[i - 1] == '\r') + s[i - 1] = '\0'; return (strcmp(sref, s) == 0); } -- cgit v1.2.3