]> granicus.if.org Git - sudo/commitdiff
Use easprintf instead of emalloc + sprintf for some things.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 18 Apr 2002 15:38:52 +0000 (15:38 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 18 Apr 2002 15:38:52 +0000 (15:38 +0000)
env.c

diff --git a/env.c b/env.c
index 42f2ce0fa27f74b7a7af6f35ef7dbc477fe49358..661a1d44a113a299df93ba1d87996f6cb4d9ca74 100644 (file)
--- a/env.c
+++ b/env.c
@@ -434,19 +434,16 @@ rebuild_env(sudo_mode, envp)
 
     /* Add the SUDO_COMMAND envariable (cmnd + args). */
     if (user_args) {
-       cp = emalloc(strlen(user_cmnd) + strlen(user_args) + 15);
-       sprintf(cp, "SUDO_COMMAND=%s %s", user_cmnd, user_args);
+       easprintf(&cp, "SUDO_COMMAND=%s %s", user_cmnd, user_args);
        insert_env(newenvp, cp);
     } else
        insert_env(newenvp, format_env("SUDO_COMMAND", user_cmnd));
 
     /* Add the SUDO_USER, SUDO_UID, SUDO_GID environment variables. */
     insert_env(newenvp, format_env("SUDO_USER", user_name));
-    cp = emalloc(MAX_UID_T_LEN + 10);
-    sprintf(cp, "SUDO_UID=%ld", (long) user_uid);
+    easprintf(&cp, "SUDO_UID=%ld", (long) user_uid);
     insert_env(newenvp, cp);
-    cp = emalloc(MAX_UID_T_LEN + 10);
-    sprintf(cp, "SUDO_GID=%ld", (long) user_gid);
+    easprintf(&cp, "SUDO_GID=%ld", (long) user_gid);
     insert_env(newenvp, cp);
 
     return(newenvp);