Skip to content

Commit d29111a

Browse files
Dhamoder NallaPaul Hohensee
Dhamoder Nalla
authored and
Paul Hohensee
committed
8348323: Corrupted timezone string in JVM crash log
Backport-of: 2bef5b4a877f4d3bc766558b8782b7b57dee79a8
1 parent ef282b7 commit d29111a

File tree

1 file changed

+1
-2
lines changed
  • src/hotspot/share/runtime

1 file changed

+1
-2
lines changed

src/hotspot/share/runtime/os.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,8 +1167,7 @@ void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) {
11671167
if (localtime_pd(&tloc, &tz) != nullptr) {
11681168
wchar_t w_buf[80];
11691169
size_t n = ::wcsftime(w_buf, 80, L"%Z", &tz);
1170-
if (n > 0) {
1171-
::wcstombs(buf, w_buf, buflen);
1170+
if (n > 0 && ::wcstombs(buf, w_buf, buflen) != (size_t)-1) {
11721171
st->print("Time: %s %s", timestring, buf);
11731172
} else {
11741173
st->print("Time: %s", timestring);

0 commit comments

Comments
 (0)