Skip to content
Snippets Groups Projects
Commit caaef6bb authored by Rolf Eike Beer's avatar Rolf Eike Beer Committed by Rolf Eike Beer
Browse files

testSystemTools: avoid strcpy()

parent ff912e4d
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@
#include <iostream>
#include <sstream>
#include <stdlib.h> /* free */
#include <string.h> /* strcmp */
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <io.h> /* _umask (MSVC) / umask (Borland) */
......@@ -535,15 +536,14 @@ static bool CheckStringOperations()
}
delete[] cres;
char* cres2 = new char[strlen("Mary Had A Little Lamb.") + 1];
strcpy(cres2, "Mary Had A Little Lamb.");
char* cres2 = strdup("Mary Had A Little Lamb.");
kwsys::SystemTools::ReplaceChars(cres2, "aeiou", 'X');
if (strcmp(cres2, "MXry HXd A LXttlX LXmb.")) {
std::cerr << "Problem with ReplaceChars "
<< "\"Mary Had A Little Lamb.\"" << std::endl;
res = false;
}
delete[] cres2;
free(cres2);
if (!kwsys::SystemTools::StringStartsWith("Mary Had A Little Lamb.",
"Mary ")) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment