]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/script/execute.c (grub_script_return): Fix potential
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 4 Feb 2012 10:52:10 +0000 (11:52 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 4 Feb 2012 10:52:10 +0000 (11:52 +0100)
NULL-dereference.
Reported by: Jim Meyering.

ChangeLog
grub-core/script/execute.c

index 35699d70d45309393433d5d5ff6ef1f4b254b682..38e6b9d8f0ac1eaa98a9689db84a8c9955a93d04 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index 95984fc2356b25e4b57fee0a144f8c783b905773..97496e9ba23ebd4a6942c037a7223f0516bd1820 100644 (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);