else {
if ((home = getenv("HOME")) != NULL) {
/* set up default */
- p += strlen(home); /* path, looking in */
- strcpy(pathbuf, home); /* $HOME first */
+ strncpy(pathbuf, home, PBUFSIZ - strlen(_PATH_DEF) - 1); /* $HOME first */
+ pathbuf[PBUFSIZ - strlen(_PATH_DEF) - 1] = '\0';
+ p += strlen(pathbuf); /* path, looking in */
*p++ = '/';
} /* if no $HOME look in current directory */
strncpy(p, _PATH_DEF, PBUFSIZ - (p - pathbuf));
}
else /* user-defined name in TERMCAP */
strncpy(pathbuf, cp, PBUFSIZ); /* still can be tokenized */
+ pathbuf[PBUFSIZ] = '\0';
*fname++ = pathbuf; /* tokenize path into vector of names */
while (*++p)
-/* $OpenBSD: getterm.c,v 1.9 1996/08/31 01:58:50 tholo Exp $ */
+/* $OpenBSD: getterm.c,v 1.10 1996/09/03 05:11:11 tholo Exp $ */
/*
* Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: getterm.c,v 1.9 1996/08/31 01:58:50 tholo Exp $";
+static char rcsid[] = "$OpenBSD: getterm.c,v 1.10 1996/09/03 05:11:11 tholo Exp $";
#endif
#include <stdlib.h>
else {
if ((home = getenv("HOME")) != NULL) {
/* set up default */
- p += strlen(home); /* path, looking in */
- strcpy(pathbuf, home); /* $HOME first */
+ strncpy(pathbuf, home, MAXPATHLEN - strlen(_PATH_CAPDEF) - 1); /* $HOME first */
+ pathbuf[MAXPATHLEN - strlen(_PATH_CAPDEF) - 1] = '\0';
+ p += strlen(pathbuf); /* path, looking in */
*p++ = '/';
} /* if no $HOME look in current directory */
strncpy(p, _PATH_CAPDEF, MAXPATHLEN - (p - pathbuf));
if ((home = getenv("HOME")) != NULL) {
/* set up default */
p += strlen(home); /* path, looking in */
- strcpy(pathbuf, home); /* $HOME first */
+ strncpy(pathbuf, home, MAXPATHLEN - strlen(_PATH_INFODEF) - 1); /* $HOME first */
+ pathbuf[MAXPATHLEN - strlen(_PATH_INFODEF) - 1] = '\0';
*p++ = '/';
} /* if no $HOME look in current directory */
strncpy(p, _PATH_INFODEF, MAXPATHLEN - (p - pathbuf));