Do a bounds check on the strcpy of environment variables onto the stack.

This commit is contained in:
Paul Traina 1996-07-15 16:29:03 +00:00
parent d9d5922eec
commit caef76e8bd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17177

View File

@ -259,7 +259,7 @@ main(argc, argv)
exit(1); exit(1);
} }
(void)strcpy(term, (p = getenv("TERM")) ? p : "network"); (void)strncpy(term, (p = getenv("TERM")) ? p : "network", sizeof(term));
if (ioctl(0, TIOCGETP, &ttyb) == 0) { if (ioctl(0, TIOCGETP, &ttyb) == 0) {
(void)strcat(term, "/"); (void)strcat(term, "/");
(void)strcat(term, speeds[(int)ttyb.sg_ospeed]); (void)strcat(term, speeds[(int)ttyb.sg_ospeed]);