Skip to content

Commit 114f2e3

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 6fb19bb commit 114f2e3

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
@@ -1213,8 +1213,7 @@ void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) {
12131213
if (localtime_pd(&tloc, &tz) != nullptr) {
12141214
wchar_t w_buf[80];
12151215
size_t n = ::wcsftime(w_buf, 80, L"%Z", &tz);
1216-
if (n > 0) {
1217-
::wcstombs(buf, w_buf, buflen);
1216+
if (n > 0 && ::wcstombs(buf, w_buf, buflen) != (size_t)-1) {
12181217
st->print("Time: %s %s", timestring, buf);
12191218
} else {
12201219
st->print("Time: %s", timestring);

0 commit comments

Comments
 (0)