]> git.proxmox.com Git - grub2.git/commitdiff
* util/grub-mount.c (root): Make const char *.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 10 Feb 2012 12:03:21 +0000 (13:03 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 10 Feb 2012 12:03:21 +0000 (13:03 +0100)
(execute_command): Make first argument a const char *.
(fuse_init): Respect format security.
(argp_parser): Make static. Remove unused variable.
(main):  Make default_root a const char *.
Respect format security.

ChangeLog
util/grub-mount.c

index 1631d5ac669e8f82bd8eb1ce2537f7ce6f66aa4d..8a17916f8e6ce692e7abb3accc5ca2f3bcd3b142 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-02-10  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * util/grub-mount.c (root): Make const char *.
+       (execute_command): Make first argument a const char *.
+       (fuse_init): Respect format security.
+       (argp_parser): Make static. Remove unused variable.
+       (main):  Make default_root a const char *.
+       Respect format security.
+
 2012-02-10  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * util/grub-probe.c (probe): Don't call gettext on already translated
index ddb4ce7ff43786c2ff2ede281d766244fd08199b..a38348aa54fa8faaacb44fcecc7a84b09ef9bc66 100644 (file)
@@ -44,7 +44,7 @@
 #include "progname.h"
 #include "argp.h"
 
-static char *root = NULL;
+static const char *root = NULL;
 grub_device_t dev = NULL;
 grub_fs_t fs = NULL;
 static char **images = NULL;
@@ -55,7 +55,7 @@ static int num_disks = 0;
 static int mount_crypt = 0;
 
 static grub_err_t
-execute_command (char *name, int n, char **args)
+execute_command (const char *name, int n, char **args)
 {
   grub_command_t cmd;
 
@@ -338,17 +338,17 @@ fuse_init (void)
       char *loop_name;
       loop_name = grub_xasprintf ("loop%d", i);
       if (!loop_name)
-       grub_util_error (grub_errmsg);
+       grub_util_error ("%s", grub_errmsg);
 
       host_file = grub_xasprintf ("(host)%s", images[i]);
       if (!host_file)
-       grub_util_error (grub_errmsg);
+       grub_util_error ("%s", grub_errmsg);
 
       argv[0] = loop_name;
       argv[1] = host_file;
 
       if (execute_command ("loopback", 2, argv))
-        grub_util_error (_("loopback command fails"));
+        grub_util_error ("%s", _("loopback command fails"));
 
       grub_free (loop_name);
       grub_free (host_file);
@@ -390,7 +390,7 @@ fuse_init (void)
 
       loop_name = grub_xasprintf ("loop%d", i);
       if (!loop_name)
-       grub_util_error (grub_errmsg);
+       grub_util_error ("%s", grub_errmsg);
 
       argv[0] = "-d";      
       argv[1] = loop_name;
@@ -422,11 +422,9 @@ print_version (FILE *stream, struct argp_state *state)
 }
 void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
 
-error_t 
+static error_t 
 argp_parser (int key, char *arg, struct argp_state *state)
 {
-  char *p;
-
   switch (key)
     {
     case 'r':
@@ -512,7 +510,8 @@ struct argp argp = {
 int
 main (int argc, char *argv[])
 {
-  char *default_root, *alloc_root;
+  const char *default_root;
+  char *alloc_root;
 
   set_program_name (argv[0]);
 
@@ -528,7 +527,7 @@ main (int argc, char *argv[])
   argp_parse (&argp, argc, argv, 0, 0, 0);
   
   if (num_disks < 2)
-    grub_util_error (_("need an image and mountpoint"));
+    grub_util_error ("%s", _("need an image and mountpoint"));
   fuse_args = xrealloc (fuse_args, (fuse_argc + 2) * sizeof (fuse_args[0]));
   fuse_args[fuse_argc] = images[num_disks - 1];
   fuse_argc++;