diff options
| author | Neil <nyamatongwe@gmail.com> | 2013-12-22 18:00:45 +1100 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2013-12-22 18:00:45 +1100 | 
| commit | ca1a5ea845c283a9c84fd2ae9f6d152cca354183 (patch) | |
| tree | d851b7c06cc7763849d504b58797199c9032b441 /lexers/LexHTML.cxx | |
| parent | 0b56a6704d1c64644d5bfef318806f8490d649ec (diff) | |
| download | scintilla-mirror-ca1a5ea845c283a9c84fd2ae9f6d152cca354183.tar.gz | |
Avoid unsafe strcpy, strncpy, and strcat replacing with safer functions which
guaranty termination where possible.
Diffstat (limited to 'lexers/LexHTML.cxx')
| -rw-r--r-- | lexers/LexHTML.cxx | 17 | 
1 files changed, 9 insertions, 8 deletions
| diff --git a/lexers/LexHTML.cxx b/lexers/LexHTML.cxx index bb70fd45b..5ea24d481 100644 --- a/lexers/LexHTML.cxx +++ b/lexers/LexHTML.cxx @@ -16,6 +16,7 @@  #include "Scintilla.h"  #include "SciLexer.h" +#include "StringCopy.h"  #include "WordList.h"  #include "LexAccessor.h"  #include "Accessor.h" @@ -929,9 +930,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty  															 (ch == '$' && chNext == '{') ||  															 (ch == '<' && chNext == '/' && chNext2 == '%'))) {  			if (ch == '%' || ch == '/') -				strcpy(makoBlockType, "%"); +				StringCopy(makoBlockType, "%");  			else if (ch == '$') -				strcpy(makoBlockType, "{"); +				StringCopy(makoBlockType, "{");  			else if (chNext == '/')  				GetNextWord(styler, i+3, makoBlockType, sizeof(makoBlockType));  			else @@ -1000,9 +1001,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty  		// handle the start Django template code  		else if (isDjango && scriptLanguage != eScriptPython && (ch == '{' && (chNext == '%' ||  chNext == '{'))) {  			if (chNext == '%') -				strcpy(djangoBlockType, "%"); +				StringCopy(djangoBlockType, "%");  			else -				strcpy(djangoBlockType, "{"); +				StringCopy(djangoBlockType, "{");  			styler.ColourTo(i - 1, StateToPrint);  			beforePreProc = state;  			if (inScriptType == eNonHtmlScript) @@ -1917,7 +1918,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty  					state = SCE_HPHP_COMMENTLINE;  				} else if (ch == '\"') {  					state = SCE_HPHP_HSTRING; -					strcpy(phpStringDelimiter, "\""); +					StringCopy(phpStringDelimiter, "\"");  				} else if (styler.Match(i, "<<<")) {  					bool isSimpleString = false;  					i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler, isSimpleString); @@ -1927,7 +1928,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty  					}  				} else if (ch == '\'') {  					state = SCE_HPHP_SIMPLESTRING; -					strcpy(phpStringDelimiter, "\'"); +					StringCopy(phpStringDelimiter, "\'");  				} else if (ch == '$' && IsPhpWordStart(chNext)) {  					state = SCE_HPHP_VARIABLE;  				} else if (IsOperator(ch)) { @@ -2047,7 +2048,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty  				state = SCE_HPHP_COMMENTLINE;  			} else if (ch == '\"') {  				state = SCE_HPHP_HSTRING; -				strcpy(phpStringDelimiter, "\""); +				StringCopy(phpStringDelimiter, "\"");  			} else if (styler.Match(i, "<<<")) {  				bool isSimpleString = false;  				i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler, isSimpleString); @@ -2057,7 +2058,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty  				}  			} else if (ch == '\'') {  				state = SCE_HPHP_SIMPLESTRING; -				strcpy(phpStringDelimiter, "\'"); +				StringCopy(phpStringDelimiter, "\'");  			} else if (ch == '$' && IsPhpWordStart(chNext)) {  				state = SCE_HPHP_VARIABLE;  			} else if (IsOperator(ch)) { | 
