diff options
author | pst <pst@FreeBSD.org> | 1996-07-25 18:27:40 +0000 |
---|---|---|
committer | pst <pst@FreeBSD.org> | 1996-07-25 18:27:40 +0000 |
commit | ce6b6b7927e8ac98af960ca87faaf06fb7132dff (patch) | |
tree | 1344f9ce53fa9cabc0eaf9c56b84fac12beaf28d /usr.bin/rlogin | |
parent | 3d45bf42bec08f165911d83c027da1e195ec62bf (diff) | |
download | FreeBSD-src-ce6b6b7927e8ac98af960ca87faaf06fb7132dff.zip FreeBSD-src-ce6b6b7927e8ac98af960ca87faaf06fb7132dff.tar.gz |
Add Bruce's improvement to security patch
Diffstat (limited to 'usr.bin/rlogin')
-rw-r--r-- | usr.bin/rlogin/rlogin.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/rlogin/rlogin.c b/usr.bin/rlogin/rlogin.c index 254c05f..8855206 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]); |