Add Bruce's improvement to security patch

This commit is contained in:
Paul Traina 1996-07-25 18:27:40 +00:00
parent 4680e2ceec
commit 7f7e1b67ff
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17284

View File

@ -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]);