Added secure clear to strings.

This commit is contained in:
John Wellbelove 2019-05-12 11:05:37 +01:00
parent ae3c65c787
commit 392ebaab91
7 changed files with 33 additions and 23 deletions

View File

@ -2076,9 +2076,14 @@ namespace etl
}
}
// Disable copy construction.
//*************************************************************************
/// Disable copy construction.
//*************************************************************************
ibasic_string(const ibasic_string&);
//*************************************************************************
/// Pointer to the string's buffer.
//*************************************************************************
T* p_buffer;
//*************************************************************************

View File

@ -38,8 +38,8 @@ SOFTWARE.
///\ingroup utilities
#define ETL_VERSION_MAJOR 14
#define ETL_VERSION_MINOR 22
#define ETL_VERSION_PATCH 1
#define ETL_VERSION_MINOR 23
#define ETL_VERSION_PATCH 0
#define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) ETL_STRINGIFY(ETL_VERSION_MINOR) ETL_STRINGIFY(ETL_VERSION_PATCH)
#define ETL_VERSION_W ETL_WIDE_STRING(ETL_CONCAT(ETL_CONCAT(ETL_VERSION_MAJOR, ETL_VERSION_MINOR), ETL_VERSION_PATCH))

View File

@ -1,3 +1,8 @@
===============================================================================
14.23.0
Added an optional secure mode to strings so that unused space will be cleared to zero
and also cleared on destruction.
===============================================================================
14.22.1
Modified memory functions so that they will not be optimised away.

View File

@ -3671,7 +3671,7 @@ namespace
text.~Text();
// Check there no non-zero values in the string.
CHECK(std::find_if(pb, pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3686,7 +3686,7 @@ namespace
text.assign(STR("ABC"));
CHECK(std::find_if(text.end(), pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(text.end(), pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3702,7 +3702,7 @@ namespace
text.erase(pb + 2, pb + 5);
// Check there no non-zero values in the remainder of the string.
CHECK(std::find_if(text.end(), pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(text.end(), pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3718,7 +3718,7 @@ namespace
text.replace(pb + 1, pb + 4, STR("G"));
// Check there no non-zero values in the remainder of the string.
CHECK(std::find_if(text.end(), pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(text.end(), pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3734,7 +3734,7 @@ namespace
text.clear();
// Check there no non-zero values in the remainder of the string.
CHECK(std::find_if(pb, pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe);
}
};
}

View File

@ -3670,7 +3670,7 @@ namespace
text.~Text();
// Check there no non-zero values in the string.
CHECK(std::find_if(pb, pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3685,7 +3685,7 @@ namespace
text.assign(STR("ABC"));
CHECK(std::find_if(text.end(), pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(text.end(), pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3701,7 +3701,7 @@ namespace
text.erase(pb + 2, pb + 5);
// Check there no non-zero values in the remainder of the string.
CHECK(std::find_if(text.end(), pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(text.end(), pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3717,7 +3717,7 @@ namespace
text.replace(pb + 1, pb + 4, STR("G"));
// Check there no non-zero values in the remainder of the string.
CHECK(std::find_if(text.end(), pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(text.end(), pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3733,7 +3733,7 @@ namespace
text.clear();
// Check there no non-zero values in the remainder of the string.
CHECK(std::find_if(pb, pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe);
}
};
}

View File

@ -3670,7 +3670,7 @@ namespace
text.~Text();
// Check there no non-zero values in the string.
CHECK(std::find_if(pb, pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3685,7 +3685,7 @@ namespace
text.assign(STR("ABC"));
CHECK(std::find_if(text.end(), pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(text.end(), pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3701,7 +3701,7 @@ namespace
text.erase(pb + 2, pb + 5);
// Check there no non-zero values in the remainder of the string.
CHECK(std::find_if(text.end(), pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(text.end(), pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3717,7 +3717,7 @@ namespace
text.replace(pb + 1, pb + 4, STR("G"));
// Check there no non-zero values in the remainder of the string.
CHECK(std::find_if(text.end(), pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(text.end(), pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3733,7 +3733,7 @@ namespace
text.clear();
// Check there no non-zero values in the remainder of the string.
CHECK(std::find_if(pb, pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe);
}
};
}

View File

@ -3670,7 +3670,7 @@ namespace
text.~Text();
// Check there no non-zero values in the string.
CHECK(std::find_if(pb, pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3685,7 +3685,7 @@ namespace
text.assign(STR("ABC"));
CHECK(std::find_if(text.end(), pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(text.end(), pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3701,7 +3701,7 @@ namespace
text.erase(pb + 2, pb + 5);
// Check there no non-zero values in the remainder of the string.
CHECK(std::find_if(text.end(), pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(text.end(), pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3717,7 +3717,7 @@ namespace
text.replace(pb + 1, pb + 4, STR("G"));
// Check there no non-zero values in the remainder of the string.
CHECK(std::find_if(text.end(), pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(text.end(), pe, [](Text::value_type x) { return x != 0; }) == pe);
}
//*************************************************************************
@ -3733,7 +3733,7 @@ namespace
text.clear();
// Check there no non-zero values in the remainder of the string.
CHECK(std::find_if(pb, pe, [](auto x) { return x != 0; }) == pe);
CHECK(std::find_if(pb, pe, [](Text::value_type x) { return x != 0; }) == pe);
}
};
}