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 | dac5800933977672e8d2d67854a97a517abbe47d (patch) | |
tree | c057a54cf4b5f01be58cc5042ee30043a2363ba6 /lexlib/WordList.cxx | |
parent | 3f4549e26cb8182fa236ea3c8a08c20a71e4da38 (diff) | |
download | scintilla-mirror-dac5800933977672e8d2d67854a97a517abbe47d.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.cxx | 5 |
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); |