* sltermin.c (): Avoid strncpy, home_ti is 1K long and

nobody really needs it whole cleared
This commit is contained in:
Andrew V. Samoilov 2004-09-03 22:08:20 +00:00
parent 7c9f703060
commit ef67afe62d
2 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2004-09-04 Pavel S. Shirshov <pavelsh@mail.ru>
* sltermin.c (): Avoid strncpy, home_ti is 1K long and
nobody really needs it whole cleared
2004-08-31 Pavel S. Shirshov <pavelsh@mail.ru>
* include/slang.h: Revert last changes - it breaks compiling

View File

@ -267,9 +267,12 @@ SLterminfo_Type *_SLtt_tigetent (char *term)
if (NULL != (home = getenv ("HOME")))
{
strncpy (home_ti, home, sizeof (home_ti) - 11);
home_ti [sizeof(home_ti) - 11] = 0;
strcat (home_ti, "/.terminfo");
size_t len = strlen (home);
if (len > sizeof (home_ti) - sizeof ("/.terminfo"))
len = sizeof (home_ti) - sizeof ("/.terminfo");
memcpy (home_ti, home, len);
memcpy (home_ti + len, "/.terminfo", sizeof ("/.terminfo"));
Terminfo_Dirs [0] = home_ti;
}