Commit fdfe840e480c56dc1119c31bb4fcc211b1b9b46f

Authored by One Thousand Gnomes
Committed by Rafael J. Wysocki
1 parent 319e2e3f63

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>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

tools/power/cpupower/utils/cpufreq-set.c
... ... @@ -257,7 +257,7 @@
257 257 print_unknown_arg();
258 258 return -EINVAL;
259 259 }
260   - if ((sscanf(optarg, "%s", gov)) != 1) {
  260 + if ((sscanf(optarg, "%19s", gov)) != 1) {
261 261 print_unknown_arg();
262 262 return -EINVAL;
263 263 }