]> granicus.if.org Git - sudo/commitdiff
Garbage collect the command argv, envp and info vectors since they are
authorTodd C. Miller <Todd.Miller@sudo.ws>
Thu, 3 May 2018 16:52:17 +0000 (10:52 -0600)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Thu, 3 May 2018 16:52:17 +0000 (10:52 -0600)
not available at policy close time.

plugins/sudoers/policy.c

index 2c26efb80f9fed57e6f11929da022362b74faeef..dbc70b09afc918a0149aaf9ba1e78decc7a11f97 100644 (file)
@@ -724,7 +724,12 @@ sudoers_policy_exec_setup(char *argv[], char *envp[], mode_t cmnd_umask,
     }
 #endif /* HAVE_SELINUX */
 
-    /* Fill in exec environment info */
+    /* Free on exit; they are not available in the close function. */
+    sudoers_gc_add(GC_VECTOR, argv);
+    sudoers_gc_add(GC_VECTOR, envp);
+    sudoers_gc_add(GC_VECTOR, command_info);
+
+    /* Fill in exec environment info. */
     *(exec_args->argv) = argv;
     *(exec_args->envp) = envp;
     *(exec_args->info) = command_info;