diff options
author | Todd C. Miller <Todd.Miller@sudo.ws> | 2022-10-21 17:04:21 -0600 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@sudo.ws> | 2022-10-21 17:04:21 -0600 |
commit | 4ec370d6aac44dfd2b26496b60967dd9b8974c8d (patch) | |
tree | d66d81451d8e7af209bcc4faed494581cd2e8a4c /src/edit_open.c | |
parent | dbba6d4a761f7b9801d6af734ab2b1bc8a90a5a2 (diff) | |
parent | 9d34c84441cdb6d0bfb91744195659c71995dc30 (diff) | |
download | sudo-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.c | 9 |
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'; |