From: Todd C. Miller Date: Sun, 4 Jun 2000 23:51:05 +0000 (+0000) Subject: Add a missing check for UserEditor == NULL X-Git-Tag: SUDO_1_6_4~270 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=61048797f01d70a1129f4b0333510672527190a9;p=sudo Add a missing check for UserEditor == NULL Add missing '+' before line number when invoking editor to fix a syntax error --- diff --git a/visudo.c b/visudo.c index a70fdcd3c..2b2bc2f06 100644 --- a/visudo.c +++ b/visudo.c @@ -237,7 +237,7 @@ main(argc, argv) */ if ((UserEditor = getenv("EDITOR")) == NULL || *UserEditor == '\0') UserEditor = getenv("VISUAL"); - if (*UserEditor == '\0') + if (UserEditor && *UserEditor == '\0') UserEditor = NULL; else if (UserEditor) { if (find_path(UserEditor, &Editor) == FOUND) { @@ -337,7 +337,7 @@ main(argc, argv) av[0] = Editor; n = 1; if (parse_error == TRUE) { - (void) snprintf(linestr, sizeof(linestr), "%d", errorlineno); + (void) snprintf(linestr, sizeof(linestr), "+%d", errorlineno); av[n++] = linestr; } av[n++] = stmp;