cpupower: Fix sscanf robustness in cpufreq-set
The cpufreq-set tool has a missing length check. This is basically just correctness but still should get fixed. One of a set of sscanf problems reported by Jackie Chang Signed-off-by: Alan Cox <alan@linux.intel.com> [rjw: Subject] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
committed by
Rafael J. Wysocki
parent
319e2e3f63
commit
fdfe840e48
@@ -257,7 +257,7 @@ int cmd_freq_set(int argc, char **argv)
|
|||||||
print_unknown_arg();
|
print_unknown_arg();
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if ((sscanf(optarg, "%s", gov)) != 1) {
|
if ((sscanf(optarg, "%19s", gov)) != 1) {
|
||||||
print_unknown_arg();
|
print_unknown_arg();
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user