diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2000-08-02 04:10:51 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2000-08-02 04:10:51 +0000 |
commit | eb9184a174a8fb2f98f2f1418f87863716a5c115 (patch) | |
tree | 02b606fefe2b41782be054be7fdd586e53befba0 /kerberosIV | |
parent | 3602a750205b32f442e2e132baa5b3e9a3c83349 (diff) |
$HOME paranoia: never use getenv("HOME") w/o checking for NULL and non-zero
Diffstat (limited to 'kerberosIV')
-rw-r--r-- | kerberosIV/src/appl/ftp/ftp/ruserpass.c | 2 | ||||
-rw-r--r-- | kerberosIV/src/lib/kafs/common.c | 2 | ||||
-rw-r--r-- | kerberosIV/src/lib/roken/glob.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/kerberosIV/src/appl/ftp/ftp/ruserpass.c b/kerberosIV/src/appl/ftp/ftp/ruserpass.c index f88d9bf5aa6..81c45785b88 100644 --- a/kerberosIV/src/appl/ftp/ftp/ruserpass.c +++ b/kerberosIV/src/appl/ftp/ftp/ruserpass.c @@ -114,7 +114,7 @@ ruserpass(char *host, char **aname, char **apass, char **aacct) hdir = getenv("HOME"); if (hdir == NULL) - hdir = "."; + return (0); snprintf(buf, sizeof(buf), "%s/.netrc", hdir); cfile = fopen(buf, "r"); if (cfile == NULL) { diff --git a/kerberosIV/src/lib/kafs/common.c b/kerberosIV/src/lib/kafs/common.c index d4ef88d282d..3a8145c584e 100644 --- a/kerberosIV/src/lib/kafs/common.c +++ b/kerberosIV/src/lib/kafs/common.c @@ -232,7 +232,7 @@ _kafs_afslog_all_local_cells(kafs_data *data, uid_t uid, const char *homedir) if (homedir == NULL) homedir = getenv("HOME"); - if (homedir != NULL) { + if (homedir != NULL && *homedir != '\0') { char home[MaxPathLen]; snprintf(home, sizeof(home), "%s/.TheseCells", homedir); find_cells(home, &cells, &index); diff --git a/kerberosIV/src/lib/roken/glob.c b/kerberosIV/src/lib/roken/glob.c index 66e8ec6db8c..8f53e56416d 100644 --- a/kerberosIV/src/lib/roken/glob.c +++ b/kerberosIV/src/lib/roken/glob.c @@ -363,7 +363,7 @@ globtilde(const Char *pattern, Char *patbuf, glob_t *pglob) * handle a plain ~ or ~/ by expanding $HOME * first and then trying the password file */ - if ((h = getenv("HOME")) == NULL) { + if ((h = getenv("HOME")) == NULL || *h == '\0') { if ((pwd = k_getpwuid(getuid())) == NULL) return pattern; else |