]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Fix a problem with kernel command
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 27 Aug 2010 18:23:39 +0000 (20:23 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 27 Aug 2010 18:23:39 +0000 (20:23 +0200)
grub-core/lib/legacy_parse.c

index 0b30ef3b105169d7a63f9e81179a238e2727852b..985a5373359a5dc3b2d60a89e9aee612c42bb113 100644 (file)
@@ -121,7 +121,7 @@ struct legacy_command legacy_commands[] =
     /* install unsupported.  */
     /* ioprobe unsupported.  */
     /* FIXME: implement command. */
-    {"kernel", "legacy_kernel %s '%s' %s\n", 4, {TYPE_TYPE_OR_NOMEM_OPTION,
+    {"kernel", "legacy_kernel %s %s '%s' %s\n", 4, {TYPE_TYPE_OR_NOMEM_OPTION,
                                                 TYPE_TYPE_OR_NOMEM_OPTION,
                                                 TYPE_FILE,
                                                 TYPE_REST_VERBATIM}, 0,
@@ -380,7 +380,7 @@ grub_legacy_parse (const char *buf, char **entryname)
          }
        for (; grub_isspace (*ptr); ptr++);
        curarg = ptr;
-       for (; !grub_isspace (*ptr); ptr++);
+       for (; *ptr && !grub_isspace (*ptr); ptr++);
        if (i != legacy_commands[cmdnum].argc - 1
            || (legacy_commands[cmdnum].flags & FLAG_IGNORE_REST))
          curarglen = ptr - curarg;
@@ -406,7 +406,7 @@ grub_legacy_parse (const char *buf, char **entryname)
              ptr = curarg;
              while (*ptr)
                {
-                 for (; grub_isspace (*ptr); ptr++);
+                 for (; *ptr && grub_isspace (*ptr); ptr++);
                  for (; *ptr && !grub_isspace (*ptr); ptr++)
                    if (*ptr == '\\' || *ptr == '\'')
                      overhead++;
@@ -421,7 +421,7 @@ grub_legacy_parse (const char *buf, char **entryname)
              outptr = outptr0;
              while (*ptr)
                {
-                 for (; grub_isspace (*ptr); ptr++);
+                 for (; *ptr && grub_isspace (*ptr); ptr++);
                  if (outptr != outptr0)
                    *outptr++ = ' ';
                  *outptr++ = '\'';
@@ -434,7 +434,6 @@ grub_legacy_parse (const char *buf, char **entryname)
                  *outptr++ = '\'';
                  if (*ptr)
                    ptr++;
-                 overhead += 3;
                }
              *outptr++ = 0;
            }
@@ -492,5 +491,7 @@ grub_legacy_parse (const char *buf, char **entryname)
          }
       }
   }
-  return grub_xasprintf (legacy_commands[cmdnum].map, args[0], args[1], args[2]);
+  
+  return grub_xasprintf (legacy_commands[cmdnum].map, args[0], args[1], args[2],
+                        args[3]);
 }