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:
parent
ddde2a6d64
commit
cd2620e439
1 changed files with 5 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue