]> granicus.if.org Git - sudo/commitdiff
Re-enable PATH_MAX check for command
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 26 May 2010 20:33:35 +0000 (16:33 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 26 May 2010 20:33:35 +0000 (16:33 -0400)
plugins/sudoers/sudoers.c

index 2d7864f81c9c2ced0a9a911be249957f3214e84a..b867d81bb64dfc13cf97a4230590b4bfff325388 100644 (file)
@@ -691,12 +691,6 @@ init_vars(char * const envp[])
 {
     char * const * ep;
 
-#if 0 /* XXX */
-    /* Sanity check command from user. */
-    if (user_cmnd == NULL && strlen(NewArgv[0]) >= PATH_MAX)
-       errorx(1, "%s: File name too long", NewArgv[0]);
-#endif
-
 #ifdef HAVE_TZSET
     (void) tzset();            /* set the timezone if applicable */
 #endif /* HAVE_TZSET */
@@ -813,13 +807,16 @@ set_cmnd(int sudo_mode)
            for (to = user_args, from = NewArgv + 1; *from; from++) {
                n = strlcpy(to, *from, size - (to - user_args));
                if (n >= size - (to - user_args))
-                   errorx(1, "internal error, init_vars() overflow");
+                   errorx(1, "internal error, set_cmnd() overflow");
                to += n;
                *to++ = ' ';
            }
            *--to = '\0';
        }
     }
+    if (strlen(user_cmnd) >= PATH_MAX)
+       errorx(1, "%s: file name too long", user_cmnd);
+
     if ((user_base = strrchr(user_cmnd, '/')) != NULL)
        user_base++;
     else