Browse Source

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.
Eugene Syromyatnikov 2 years ago
parent
commit
395c90f71c
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      reboot.c

+ 6
- 1
reboot.c View File

@@ -17,7 +17,12 @@ SYS_FUNC(reboot)
17 17
 	printxval(bootflags3, cmd, "LINUX_REBOOT_CMD_???");
18 18
 	if (cmd == LINUX_REBOOT_CMD_RESTART2) {
19 19
 		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);
21 26
 	}
22 27
 	return RVAL_DECODED;
23 28
 }

Loading…
Cancel
Save