reboot.c: limit printing of the fourth argument to 255 bytes

The size of kernel buffer is 256 bytes and the last byte is always zero.

* reboot.c (SYS_FUNC(reboot)): Replace printstr call with printstr_ex
with size of 255 and style flag QUOTE_0_TERMINATED.
This commit is contained in:
Eugene Syromyatnikov 2018-01-10 05:27:49 +01:00 committed by Dmitry V. Levin
parent 92eb77e8c3
commit 395c90f71c

View File

@ -17,7 +17,12 @@ SYS_FUNC(reboot)
printxval(bootflags3, cmd, "LINUX_REBOOT_CMD_???");
if (cmd == LINUX_REBOOT_CMD_RESTART2) {
tprints(", ");
printstr(tcp, tcp->u_arg[3]);
/*
* The size of kernel buffer is 256 bytes and
* the last byte is always zero, at most 255 bytes
* are copied from the user space.
*/
printstr_ex(tcp, tcp->u_arg[3], 255, QUOTE_0_TERMINATED);
}
return RVAL_DECODED;
}