Skip to content

Commit

Permalink
thermal: cpu_cooling: use snprintf instead of sprintf
Browse files Browse the repository at this point in the history
Limit the amount of bytes written to dev_name by
secure writing with snprintf.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
  • Loading branch information
Eduardo Valentin authored and Zhang Rui committed Apr 24, 2013
1 parent 135266b commit 99871a7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/thermal/cpu_cooling.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ struct thermal_cooling_device *cpufreq_cooling_register(
return ERR_PTR(-EINVAL);
}

sprintf(dev_name, "thermal-cpufreq-%d", cpufreq_dev->id);
snprintf(dev_name, sizeof(dev_name), "thermal-cpufreq-%d",
cpufreq_dev->id);

cool_dev = thermal_cooling_device_register(dev_name, cpufreq_dev,
&cpufreq_cooling_ops);
Expand Down

0 comments on commit 99871a7

Please sign in to comment.