< prev index next >
src/os/linux/vm/os_linux.cpp
Print this page
rev 11179 : 8140594: Various minor code improvements (compiler)
Reviewed-by: thartmann
@@ -1911,13 +1911,14 @@
int fd = ::open(filename, O_RDONLY);
if (fd == -1) {
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);
}
::close(fd);
@@ -6077,11 +6078,11 @@
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",
+ 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;
}
< prev index next >