Skip to content

Commit

Permalink
cpupower: Fix sscanf robustness in cpufreq-set
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
One Thousand Gnomes authored and Rafael J. Wysocki committed Jan 8, 2014
1 parent 319e2e3 commit fdfe840
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/power/cpupower/utils/cpufreq-set.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit fdfe840

Please sign in to comment.