diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-02-15 16:32:12 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-02-15 16:34:33 -0800 |
commit | 26830a4972f3f45a142d00e1d1ad221f6657629f (patch) | |
tree | eb1204c22c973229ed254092503cec22d79a9e61 | |
parent | ea0d56724ee73a558ca85a3febb8eff3bc627eb1 (diff) | |
download | syslinux-elf-26830a4972f3f45a142d00e1d1ad221f6657629f.tar.gz syslinux-elf-26830a4972f3f45a142d00e1d1ad221f6657629f.tar.xz syslinux-elf-26830a4972f3f45a142d00e1d1ad221f6657629f.zip |
ifcpu64: fix handing with less than three arguments
Due to a silly coding error, when passed with only two arguments we
would use them in order 1 -- 2 -- 1 instead of 1 -- 2 -- 2 as was
intended. Fix.
Reported-by: Luciano Miguel Ferreira Rocha <strange@nsk.no-ip.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | com32/modules/ifcpu64.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/com32/modules/ifcpu64.c b/com32/modules/ifcpu64.c index 7d4581dd..c5979191 100644 --- a/com32/modules/ifcpu64.c +++ b/com32/modules/ifcpu64.c @@ -101,9 +101,7 @@ int main(int argc, char *argv[]) int i; int n; - for (i = 0; i < 3; i++) - args[i] = &argv[1]; - + args[0] = &argv[1]; n = 1; for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "--")) { @@ -113,6 +111,10 @@ int main(int argc, char *argv[]) if (n >= 3) break; } + while (n < 3) { + args[n] = args[n-1]; + n++; + } boot_args(cpu_has_feature(X86_FEATURE_LM) ? args[0] : cpu_has_feature(X86_FEATURE_PAE) ? args[1] : |