Skip to content

Commit 2eef89c

Browse files
committed
merge bitcoin#27317: Check that the timestamp string is non-empty to avoid undefined behavior
1 parent de6c0ae commit 2eef89c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/logging.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ std::string BCLog::Logger::LogTimestampStr(const std::string& str)
395395
if (m_started_new_line) {
396396
int64_t nTimeMicros = GetTimeMicros();
397397
strStamped = FormatISO8601DateTime(nTimeMicros/1000000);
398-
if (m_log_time_micros) {
398+
if (m_log_time_micros && !strStamped.empty()) {
399399
strStamped.pop_back();
400400
strStamped += strprintf(".%06dZ", nTimeMicros%1000000);
401401
}

0 commit comments

Comments
 (0)