/* Take the user specified one */
e = secure_getenv("HOME");
- if (e && path_is_absolute(e)) {
+ if (e && path_is_valid(e) && path_is_absolute(e)) {
h = strdup(e);
if (!h)
return -ENOMEM;
if (!p)
return errno > 0 ? -errno : -ESRCH;
- if (!path_is_absolute(p->pw_dir))
+ if (!path_is_valid(p->pw_dir) ||
+ !path_is_absolute(p->pw_dir))
return -EINVAL;
h = strdup(p->pw_dir);
/* Take the user specified one */
e = getenv("SHELL");
- if (e) {
+ if (e && path_is_valid(e) && path_is_absolute(e)) {
s = strdup(e);
if (!s)
return -ENOMEM;
if (!p)
return errno > 0 ? -errno : -ESRCH;
- if (!path_is_absolute(p->pw_shell))
+ if (!path_is_valid(p->pw_shell) ||
+ !path_is_absolute(p->pw_shell))
return -EINVAL;
s = strdup(p->pw_shell);