aboutsummaryrefslogtreecommitdiffstats
path: root/community/mingetty/0003-limit_tty_length.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/mingetty/0003-limit_tty_length.patch')
-rw-r--r--community/mingetty/0003-limit_tty_length.patch22
1 files changed, 22 insertions, 0 deletions
diff --git a/community/mingetty/0003-limit_tty_length.patch b/community/mingetty/0003-limit_tty_length.patch
new file mode 100644
index 00000000000..b477f4cfcd4
--- /dev/null
+++ b/community/mingetty/0003-limit_tty_length.patch
@@ -0,0 +1,22 @@
+Limit TTY name to size of `buf' buffer
+
+Patch from <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=221841>.
+--- a/mingetty.c
++++ b/mingetty.c
+@@ -138,11 +138,12 @@
+ int fd;
+
+ /* Set up new standard input. */
+- if (tty[0] == '/')
+- strcpy (buf, tty);
+- else {
++ if (tty[0] == '/') {
++ strncpy (buf, tty, sizeof(buf)-1);
++ buf[sizeof(buf)-1] = '\0';
++ } else {
+ strcpy (buf, "/dev/");
+- strcat (buf, tty);
++ strncat (buf, tty, sizeof(buf)-strlen(buf)-1);
+ }
+ /* There is always a race between this reset and the call to
+ vhangup() that s.o. can use to get access to your tty. */