aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorPaul Traina <pst@FreeBSD.org>1996-07-25 18:27:40 +0000
committerPaul Traina <pst@FreeBSD.org>1996-07-25 18:27:40 +0000
commit7f7e1b67ff834788f22de5071ed13665df36fd4f (patch)
tree1344f9ce53fa9cabc0eaf9c56b84fac12beaf28d /usr.bin
parent4680e2ceecb117d3d9008fe13ab1761ddde95055 (diff)
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rlogin/rlogin.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/rlogin/rlogin.c b/usr.bin/rlogin/rlogin.c
index 254c05f5969d..885520627124 100644
--- a/usr.bin/rlogin/rlogin.c
+++ b/usr.bin/rlogin/rlogin.c
@@ -102,6 +102,7 @@ u_char escapechar = '~';
char *speeds[] = {
"0", "50", "75", "110", "134", "150", "200", "300", "600", "1200",
"1800", "2400", "4800", "9600", "19200", "38400", "57600", "115200"
+#define MAX_SPEED_LENGTH (sizeof("115200") - 1)
};
#ifdef OLDSUN
@@ -259,7 +260,11 @@ main(argc, argv)
exit(1);
}
- (void)strncpy(term, (p = getenv("TERM")) ? p : "network", sizeof(term));
+#define MAX_TERM_LENGTH (sizeof(term) - 1 - MAX_SPEED_LENGTH - 1)
+
+ (void)strncpy(term, (p = getenv("TERM")) ? p : "network",
+ MAX_TERM_LENGTH);
+ term[MAX_TERM_LENGTH] = '\0';
if (ioctl(0, TIOCGETP, &ttyb) == 0) {
(void)strcat(term, "/");
(void)strcat(term, speeds[(int)ttyb.sg_ospeed]);