* util/grub-mount.c (fuse_init): Avoid improper use of strings.

* util/grub-fstest.c (fstest): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-10 14:12:43 +01:00
parent 7e94d044ad
commit 102fae4a1c
3 changed files with 15 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2012-02-10 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mount.c (fuse_init): Avoid improper use of strings.
* util/grub-fstest.c (fstest): Likewise.
2012-02-10 Vladimir Serbinenko <phcoder@gmail.com> 2012-02-10 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/geli.c (grub_md_sha256_real): Respect format security. * grub-core/disk/geli.c (grub_md_sha256_real): Respect format security.

View file

@ -342,12 +342,13 @@ fstest (int n)
} }
{ {
char *argv[2] = { "-a", NULL};
if (mount_crypt) if (mount_crypt)
{ {
char *argv[2] = { xstrdup ("-a"), NULL};
if (execute_command ("cryptomount", 1, argv)) if (execute_command ("cryptomount", 1, argv))
grub_util_error (_("`cryptomount' command fails: %s"), grub_util_error (_("`cryptomount' command fails: %s"),
grub_errmsg); grub_errmsg);
free (argv[0]);
} }
} }
@ -396,7 +397,7 @@ fstest (int n)
grub_device_t dev; grub_device_t dev;
grub_fs_t fs; grub_fs_t fs;
char *uuid = 0; char *uuid = 0;
char *argv[3] = { "-l", NULL, NULL}; char *argv[3] = { xstrdup ("-l"), NULL, NULL};
dev = grub_device_open (n ? args[0] : 0); dev = grub_device_open (n ? args[0] : 0);
if (!dev) if (!dev)
grub_util_error ("%s", grub_errmsg); grub_util_error ("%s", grub_errmsg);
@ -411,6 +412,7 @@ fstest (int n)
grub_util_error ("%s", _("couldn't retrieve UUID")); grub_util_error ("%s", _("couldn't retrieve UUID"));
argv[1] = uuid; argv[1] = uuid;
execute_command ("xnu_uuid", 2, argv); execute_command ("xnu_uuid", 2, argv);
grub_free (argv[0]);
grub_free (uuid); grub_free (uuid);
grub_device_close (dev); grub_device_close (dev);
} }
@ -424,12 +426,13 @@ fstest (int n)
if (!loop_name) if (!loop_name)
grub_util_error ("%s", grub_errmsg); grub_util_error ("%s", grub_errmsg);
argv[0] = "-d"; argv[0] = xstrdup ("-d");
argv[1] = loop_name; argv[1] = loop_name;
execute_command ("loopback", 2, argv); execute_command ("loopback", 2, argv);
grub_free (loop_name); grub_free (loop_name);
grub_free (argv[0]);
} }
} }

View file

@ -356,9 +356,10 @@ fuse_init (void)
if (mount_crypt) if (mount_crypt)
{ {
char *argv[2] = { "-a", NULL}; char *argv[2] = { xstrdup ("-a"), NULL};
if (execute_command ("cryptomount", 1, argv)) if (execute_command ("cryptomount", 1, argv))
grub_util_error (_("cryptomount command fails: %s"), grub_errmsg); grub_util_error (_("cryptomount command fails: %s"), grub_errmsg);
free (argv[0]);
} }
grub_lvm_fini (); grub_lvm_fini ();
@ -392,11 +393,12 @@ fuse_init (void)
if (!loop_name) if (!loop_name)
grub_util_error ("%s", grub_errmsg); grub_util_error ("%s", grub_errmsg);
argv[0] = "-d"; argv[0] = xstrdup ("-d");
argv[1] = loop_name; argv[1] = loop_name;
execute_command ("loopback", 2, argv); execute_command ("loopback", 2, argv);
grub_free (argv[0]);
grub_free (loop_name); grub_free (loop_name);
} }