ldlinux: Don't drop args if we auto-lookup cmd extension
authorMatt Fleming <matt.fleming@intel.com>
Tue, 1 May 2012 15:00:12 +0000 (16:00 +0100)
committerMatt Fleming <matt.fleming@intel.com>
Tue, 1 May 2012 15:00:12 +0000 (16:00 +0100)
If we automatically lookup the extension for a command and the user
has supplied an argument to that command we incorrectly stamp the NUL
byte after the extension, and not after the argument, thereby
effectively erasing the argument.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
com32/elflink/ldlinux/ldlinux.c

index da93c54..1891526 100644 (file)
@@ -124,7 +124,7 @@ static const char *apply_extension(const char *kernel, const char *ext)
        /* Copy the rest of the command line */
        strcpy(k + len + elen, p);
 
-       k[len + elen] = '\0';
+       k[len + elen + strlen(p)] = '\0';
 
        return k;
 }