BUG: Fixed buffer size in MakeXMLSafe.
This commit is contained in:
parent
d609e037b9
commit
cb95dde1e4
@ -208,7 +208,6 @@ static const char* cmCTestMemCheckResultStrings[] = {
|
|||||||
std::string cmCTest::MakeXMLSafe(const std::string& str)
|
std::string cmCTest::MakeXMLSafe(const std::string& str)
|
||||||
{
|
{
|
||||||
cmOStringStream ost;
|
cmOStringStream ost;
|
||||||
char buffer[10];
|
|
||||||
// By uncommenting the lcnt code, it will put newline every 120 characters
|
// By uncommenting the lcnt code, it will put newline every 120 characters
|
||||||
//int lcnt = 0;
|
//int lcnt = 0;
|
||||||
for (std::string::size_type pos = 0; pos < str.size(); pos ++ )
|
for (std::string::size_type pos = 0; pos < str.size(); pos ++ )
|
||||||
@ -216,6 +215,7 @@ std::string cmCTest::MakeXMLSafe(const std::string& str)
|
|||||||
unsigned char ch = str[pos];
|
unsigned char ch = str[pos];
|
||||||
if ( (ch > 126 || ch < 32) && ch != 9 && ch != 10 && ch != 13 )
|
if ( (ch > 126 || ch < 32) && ch != 9 && ch != 10 && ch != 13 )
|
||||||
{
|
{
|
||||||
|
char buffer[33];
|
||||||
sprintf(buffer, "<%d>", (int)ch);
|
sprintf(buffer, "<%d>", (int)ch);
|
||||||
//sprintf(buffer, "&#x%0x;", (unsigned int)ch);
|
//sprintf(buffer, "&#x%0x;", (unsigned int)ch);
|
||||||
ost << buffer;
|
ost << buffer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user