summaryrefslogtreecommitdiff
path: root/src/edit_open.c
diff options
context:
space:
mode:
authorTodd C. Miller <Todd.Miller@sudo.ws>2022-10-21 17:04:21 -0600
committerTodd C. Miller <Todd.Miller@sudo.ws>2022-10-21 17:04:21 -0600
commit4ec370d6aac44dfd2b26496b60967dd9b8974c8d (patch)
treed66d81451d8e7af209bcc4faed494581cd2e8a4c /src/edit_open.c
parentdbba6d4a761f7b9801d6af734ab2b1bc8a90a5a2 (diff)
parent9d34c84441cdb6d0bfb91744195659c71995dc30 (diff)
downloadsudo-SUDO_1_9_12.tar.gz
Merge sudo 1.9.12 from tip.SUDO_1_9_12
Diffstat (limited to 'src/edit_open.c')
-rw-r--r--src/edit_open.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/edit_open.c b/src/edit_open.c
index cd0418406..091eed838 100644
--- a/src/edit_open.c
+++ b/src/edit_open.c
@@ -493,6 +493,7 @@ sudo_edit_parent_valid(char *path, int sflags, struct sudo_cred *user_cred,
struct stat sb;
bool ret = false;
char *slash;
+ char pathbuf[2];
int dfd;
debug_decl(sudo_edit_parent_valid, SUDO_DEBUG_EDIT);
@@ -500,9 +501,13 @@ sudo_edit_parent_valid(char *path, int sflags, struct sudo_cred *user_cred,
slash = strrchr(path, '/');
if (slash == NULL) {
/* cwd */
- path = ".";
+ pathbuf[0] = '.';
+ pathbuf[1] = '\0';
+ path = pathbuf;
} else if (slash == path) {
- path = "/";
+ pathbuf[0] = '/';
+ pathbuf[1] = '\0';
+ path = pathbuf;
slash = NULL;
} else {
*slash = '\0';