|
|
38ab4d |
From 701377c07bb7f8a72680d797f22ec30299789fe1 Mon Sep 17 00:00:00 2001
|
|
|
38ab4d |
From: Taku Izumi <izumi.taku@jp.fujitsu.com>
|
|
|
38ab4d |
Date: Tue, 26 Jan 2016 14:32:50 +0900
|
|
|
38ab4d |
Subject: [PATCH 29/31] Fix insusufficient validation check of -M option
|
|
|
38ab4d |
|
|
|
38ab4d |
The acceptable range of -M (--mirror-above-4G) option should
|
|
|
38ab4d |
be from 0 to 50. So the negative value should be rejected.
|
|
|
38ab4d |
Otherwise unintended value can be specified.
|
|
|
38ab4d |
|
|
|
38ab4d |
e.g.
|
|
|
38ab4d |
|
|
|
38ab4d |
> efibootmgr -M -3
|
|
|
38ab4d |
...
|
|
|
38ab4d |
MirroredPercentageAbove4G: 25.00
|
|
|
38ab4d |
MirrorMemoryBelow4GB: true
|
|
|
38ab4d |
RequestMirroredPercentageAbove4G: 652.36
|
|
|
38ab4d |
RequestMirrorMemoryBelow4GB: true
|
|
|
38ab4d |
|
|
|
38ab4d |
652.36 is invalid value for MirroredPercentageAbove4G and should
|
|
|
38ab4d |
not be specified.
|
|
|
38ab4d |
|
|
|
38ab4d |
Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
|
|
|
38ab4d |
---
|
|
|
38ab4d |
src/efibootmgr/efibootmgr.c | 2 +-
|
|
|
38ab4d |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
38ab4d |
|
|
|
38ab4d |
diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c
|
|
|
38ab4d |
index 7cb87fa..ffecc55 100644
|
|
|
38ab4d |
--- a/src/efibootmgr/efibootmgr.c
|
|
|
38ab4d |
+++ b/src/efibootmgr/efibootmgr.c
|
|
|
38ab4d |
@@ -1286,7 +1286,7 @@ parse_opts(int argc, char **argv)
|
|
|
38ab4d |
case 'M':
|
|
|
38ab4d |
opts.set_mirror_hi = 1;
|
|
|
38ab4d |
rc = sscanf(optarg, "%f", &fnum);
|
|
|
38ab4d |
- if (rc == 1 && fnum <= 50) {
|
|
|
38ab4d |
+ if (rc == 1 && fnum <= 50 && fnum >= 0) {
|
|
|
38ab4d |
opts.above4g = fnum * 100; /* percent to basis points */
|
|
|
38ab4d |
}
|
|
|
38ab4d |
else {
|
|
|
38ab4d |
--
|
|
|
38ab4d |
2.7.4
|
|
|
38ab4d |
|