-DJSONCPP_USE_SECURE_MEMORY=1 for cmake
Add allocator.h to amalgamated header
Test JSONCPP_USE_SECURE_MEMORY in Travis
diff --git a/src/jsontestrunner/main.cpp b/src/jsontestrunner/main.cpp
index 60f7e32..a1d911d 100644
--- a/src/jsontestrunner/main.cpp
+++ b/src/jsontestrunner/main.cpp
@@ -33,9 +33,6 @@
#endif
buffer[sizeof(buffer) - 1] = 0;
JSONCPP_STRING s(buffer);
-#if JSON_USE_SECURE_MEMORY
- memset(&buffer, 0, sizeof(buffer));
-#endif
JSONCPP_STRING::size_type index = s.find_last_of("eE");
if (index != JSONCPP_STRING::npos) {
JSONCPP_STRING::size_type hasSign =
@@ -69,9 +66,6 @@
if (fread(buffer, 1, usize, file) == usize)
text = buffer;
fclose(file);
-#if JSON_USE_SECURE_MEMORY
- memset(buffer, 0, static_cast<size_t>(size + 1));
-#endif
delete[] buffer;
return text;
}
@@ -151,7 +145,7 @@
Json::Value* root)
{
Json::Reader reader(features);
- bool parsingSuccessful = reader.parse(input, *root);
+ bool parsingSuccessful = reader.parse(input.data(), input.data() + input.size(), *root);
if (!parsingSuccessful) {
printf("Failed to parse %s file: \n%s\n",
kind.c_str(),