--- a/hotspot/src/os/linux/vm/os_linux.cpp Mon May 09 23:49:22 2016 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.cpp Tue May 03 12:23:06 2016 +0200
@@ -1913,9 +1913,10 @@
return false;
}
- char buf[32];
+ char buf[33];
int bytes;
- while ((bytes = ::read(fd, buf, sizeof(buf))) > 0) {
+ buf[32] = '\0';
+ while ((bytes = ::read(fd, buf, sizeof(buf)-1)) > 0) {
st->print_raw(buf, bytes);
}
@@ -6033,8 +6034,8 @@
if (core_pattern[0] == '|') {
written = jio_snprintf(buffer, bufferSize,
- "\"%s\" (or dumping to %s/core.%d)",
- &core_pattern[1], p, current_process_id());
+ "\"%s\" (or dumping to %s/core.%d)",
+ &core_pattern[1], p, current_process_id());
} else {
written = jio_snprintf(buffer, bufferSize, "%s/%s", p, core_pattern);
}
@@ -6067,20 +6068,20 @@
char *p = &buf[len];
jio_snprintf(p, buflen-len,
- "\n\n"
- "Do you want to debug the problem?\n\n"
- "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " UINTX_FORMAT " (" INTPTR_FORMAT ")\n"
- "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
- "Otherwise, press RETURN to abort...",
- os::current_process_id(), os::current_process_id(),
- os::current_thread_id(), os::current_thread_id());
+ "\n\n"
+ "Do you want to debug the problem?\n\n"
+ "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " UINTX_FORMAT " (" INTPTR_FORMAT ")\n"
+ "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
+ "Otherwise, press RETURN to abort...",
+ os::current_process_id(), os::current_process_id(),
+ os::current_thread_id(), os::current_thread_id());
bool yes = os::message_box("Unexpected Error", buf);
if (yes) {
// yes, user asked VM to launch debugger
- jio_snprintf(buf, sizeof(buf), "gdb /proc/%d/exe %d",
- os::current_process_id(), os::current_process_id());
+ jio_snprintf(buf, sizeof(char)*buflen, "gdb /proc/%d/exe %d",
+ os::current_process_id(), os::current_process_id());
os::fork_and_exec(buf);
yes = false;