Skip to content

Commit 395c90f

Browse files
esyrldv-alt
authored andcommitted
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.
1 parent 92eb77e commit 395c90f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

reboot.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ SYS_FUNC(reboot)
1717
printxval(bootflags3, cmd, "LINUX_REBOOT_CMD_???");
1818
if (cmd == LINUX_REBOOT_CMD_RESTART2) {
1919
tprints(", ");
20-
printstr(tcp, tcp->u_arg[3]);
20+
/*
21+
* The size of kernel buffer is 256 bytes and
22+
* the last byte is always zero, at most 255 bytes
23+
* are copied from the user space.
24+
*/
25+
printstr_ex(tcp, tcp->u_arg[3], 255, QUOTE_0_TERMINATED);
2126
}
2227
return RVAL_DECODED;
2328
}

0 commit comments

Comments
 (0)