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:
One Thousand Gnomes 2013-12-17 15:07:31 +00:00 committed by Rafael J. Wysocki
parent 319e2e3f63
commit fdfe840e48
1 changed files with 1 additions and 1 deletions

View File

@ -257,7 +257,7 @@ int cmd_freq_set(int argc, char **argv)
print_unknown_arg();
return -EINVAL;
}
if ((sscanf(optarg, "%s", gov)) != 1) {
if ((sscanf(optarg, "%19s", gov)) != 1) {
print_unknown_arg();
return -EINVAL;
}