* grub-core/script/execute.c (grub_script_return): Fix potential

NULL-dereference.
	Reported by: Jim Meyering.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-04 11:52:10 +01:00
parent 498453f661
commit ac576cde1d
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2012-02-04 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/script/execute.c (grub_script_return): Fix potential
NULL-dereference.
Reported by: Jim Meyering.
2012-02-03 Vladimir Serbinenko <phcoder@gmail.com>
* po/POTFILES.in: Regenerate.

View File

@ -161,8 +161,12 @@ grub_script_return (grub_command_t cmd __attribute__((unused)),
if (argc == 0)
{
char *t;
function_return = 1;
return grub_strtoul (grub_env_get ("?"), NULL, 10);
t = grub_env_get ("?");
if (!t)
return GRUB_ERR_NONE;
return grub_strtoul (t, NULL, 10);
}
n = grub_strtoul (argv[0], &p, 10);