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 /src/CaseConvert.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 'src/CaseConvert.cxx')
-rw-r--r-- | src/CaseConvert.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/CaseConvert.cxx b/src/CaseConvert.cxx index f983458c0..badaca411 100644 --- a/src/CaseConvert.cxx +++ b/src/CaseConvert.cxx @@ -13,6 +13,7 @@ #include <vector> #include <algorithm> +#include "StringCopy.h" #include "CaseConvert.h" #include "UniConversion.h" #include "UnicodeFromUTF8.h" @@ -367,6 +368,9 @@ class CaseConverter : public ICaseConverter { enum { maxConversionLength=6 }; struct ConversionString { char conversion[maxConversionLength+1]; + ConversionString() { + conversion[0] = '\0'; + } }; // Conversions are initially store in a vector of structs but then decomposed into // parallel arrays as that is about 10% faster to search. @@ -374,7 +378,7 @@ class CaseConverter : public ICaseConverter { int character; ConversionString conversion; CharacterConversion(int character_=0, const char *conversion_="") : character(character_) { - strcpy(conversion.conversion, conversion_); + StringCopy(conversion.conversion, conversion_); } bool operator<(const CharacterConversion &other) const { return character < other.character; |