Merge pull request #2117 from egorenar/fix-formatr-string-overflow-in-logger-writeheader

Logger: Fix format string overflow in writeHeader()
pull/2125/head
Tatsuhiro Tsujikawa 2023-10-09 17:28:41 +09:00 committed by GitHub
commit 076dea3896
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -133,8 +133,8 @@ void writeHeader(Output& fp, Logger::LEVEL level, const char* sourceFile,
size_t dateLength = size_t dateLength =
strftime(datestr, sizeof(datestr), "%Y-%m-%d %H:%M:%S", &tm); strftime(datestr, sizeof(datestr), "%Y-%m-%d %H:%M:%S", &tm);
assert(dateLength <= (size_t)20); assert(dateLength <= (size_t)20);
fp.printf("%s.%06ld [%s] [%s:%d] ", datestr, tv.tv_usec, levelToString(level), fp.printf("%s.%06ld [%s] [%s:%d] ", datestr, (unsigned long)tv.tv_usec,
sourceFile, lineNum); levelToString(level), sourceFile, lineNum);
} }
} // namespace } // namespace