Skip to content

Commit 2bef5b4

Browse files
Dhamoder Nallakevinjwalls
Dhamoder Nalla
authored andcommitted
8348323: Corrupted timezone string in JVM crash log
Reviewed-by: dholmes, amitkumar, kevinw
1 parent 3a8680e commit 2bef5b4

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

0 commit comments

Comments
 (0)