Fix end iterator dereference with specific util::strftime() input

A format string with a trailing '%' character at the end would cause an
implementation detail to dereference the end iterator of a string. Since
the underlying storage is a null-terminated string, this would be
harmless in practice.

Found by cppcheck.
This commit is contained in:
Ignacio R. Morelle 2015-07-06 22:44:00 -03:00
parent 40eee388b0
commit 390c93a191

View file

@ -48,6 +48,11 @@ static std::string reformat(const std::string& format, const std::tm* time,
if (*it == '%') {
++it;
if(it == format.end()) {
new_format += "%";
break;
}
bool unrecognized = false;
if (!locale_correct) {