Unit test for exptilde

This commit is contained in:
Todd C. Miller
2020-09-01 06:26:05 -06:00
parent 6bdfd010d2
commit 86513c78b6
5 changed files with 143 additions and 8 deletions

View File

@@ -74,7 +74,7 @@ expand_tilde(char **path, const char *user)
*slash = '\0';
opath = slash + 1;
} else {
opath = NULL;
opath = "";
}
}
pw = sudo_getpwnam(user);
@@ -86,8 +86,7 @@ expand_tilde(char **path, const char *user)
debug_return_bool(false);
}
len = asprintf(&npath, "%s%s%s", pw->pw_dir, opath ? "/" : "",
opath ? opath : "");
len = asprintf(&npath, "%s%s%s", pw->pw_dir, slash ? "/" : "", opath);
sudo_pw_delref(pw);
if (len == -1) {
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));