+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
#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;
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;
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);
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;
}
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':
int
main (int argc, char *argv[])
{
- char *default_root, *alloc_root;
+ const char *default_root;
+ char *alloc_root;
set_program_name (argv[0]);
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++;