aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexlib/WordList.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2013-12-22 18:00:45 +1100
committerNeil <nyamatongwe@gmail.com>2013-12-22 18:00:45 +1100
commitca1a5ea845c283a9c84fd2ae9f6d152cca354183 (patch)
treed851b7c06cc7763849d504b58797199c9032b441 /lexlib/WordList.cxx
parent0b56a6704d1c64644d5bfef318806f8490d649ec (diff)
downloadscintilla-mirror-ca1a5ea845c283a9c84fd2ae9f6d152cca354183.tar.gz
Avoid unsafe strcpy, strncpy, and strcat replacing with safer functions which
guaranty termination where possible.
Diffstat (limited to 'lexlib/WordList.cxx')
-rw-r--r--lexlib/WordList.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/lexlib/WordList.cxx b/lexlib/WordList.cxx
index 1f7127999..e789c0eaf 100644
--- a/lexlib/WordList.cxx
+++ b/lexlib/WordList.cxx
@@ -122,8 +122,9 @@ static void SortWordList(char **words, unsigned int len) {
void WordList::Set(const char *s) {
Clear();
- list = new char[strlen(s) + 1];
- strcpy(list, s);
+ const size_t lenS = strlen(s) + 1;
+ list = new char[lenS];
+ memcpy(list, s, lenS);
words = ArrayFromWordList(list, &len, onlyLineEnds);
#ifdef _MSC_VER
std::sort(words, words + len, cmpWords);