diff options
Diffstat (limited to 'plugins/sudoers/editor.c')
-rw-r--r-- | plugins/sudoers/editor.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/plugins/sudoers/editor.c b/plugins/sudoers/editor.c index db55fc719..5ca4eb0af 100644 --- a/plugins/sudoers/editor.c +++ b/plugins/sudoers/editor.c @@ -1,7 +1,7 @@ /* * SPDX-License-Identifier: ISC * - * Copyright (c) 2010-2015 Todd C. Miller <Todd.Miller@sudo.ws> + * Copyright (c) 2010-2015, 2020-2022 Todd C. Miller <Todd.Miller@sudo.ws> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -103,10 +103,8 @@ copy_arg(const char *src, size_t len) if ((copy = malloc(len + 1)) != NULL) { sudoers_gc_add(GC_PTR, copy); for (dst = copy; src < src_end; ) { - if (src[0] == '\\' && src[1] != '\0') { + if (src[0] == '\\' && src[1] != '\0') src++; - continue; - } *dst++ = *src++; } *dst = '\0'; @@ -126,7 +124,7 @@ copy_arg(const char *src, size_t len) * as well as the argument vector. */ static char * -resolve_editor(const char *ed, size_t edlen, int nfiles, char **files, +resolve_editor(const char *ed, size_t edlen, int nfiles, char * const *files, int *argc_out, char ***argv_out, char * const *allowlist) { char **nargv = NULL, *editor = NULL, *editor_path = NULL; @@ -177,7 +175,7 @@ resolve_editor(const char *ed, size_t edlen, int nfiles, char **files, goto oom; } if (nfiles != 0) { - nargv[nargc++] = "--"; + nargv[nargc++] = (char *)"--"; while (nfiles--) nargv[nargc++] = *files++; } @@ -211,10 +209,11 @@ oom: * as well as the argument vector. */ char * -find_editor(int nfiles, char **files, int *argc_out, char ***argv_out, +find_editor(int nfiles, char * const *files, int *argc_out, char ***argv_out, char * const *allowlist, const char **env_editor) { - char *ev[3], *editor_path = NULL; + char *editor_path = NULL; + const char *ev[3]; unsigned int i; debug_decl(find_editor, SUDOERS_DEBUG_UTIL); |