From c6d9c772d77641ecb9eea2154e50506dbdae427e Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 19 May 2013 21:25:29 +1000 Subject: Don't dereference character string when length is 0. May be a NULL pointer and cause a crash and shouldn't read beyond length anyway. --- src/Editor.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Editor.cxx b/src/Editor.cxx index 2ebe1a759..59e2678ab 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -4147,7 +4147,7 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { if (treatAsDBCS) { NotifyChar((static_cast(s[0]) << 8) | static_cast(s[1])); - } else { + } else if (len > 0) { int byte = static_cast(s[0]); if ((byte < 0xC0) || (1 == len)) { // Handles UTF-8 characters between 0x01 and 0x7F and single byte -- cgit v1.2.3