PM / OPP: Use snprintf() instead of sprintf()
authorViresh Kumar <viresh.kumar@linaro.org>
Tue, 5 Jan 2016 10:45:54 +0000 (16:15 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 6 Jan 2016 01:38:27 +0000 (02:38 +0100)
commit5ff24d601092b222340b28466e263b1c4559407e
tree13b6a6a3058ec97b126cbbf230fdd25ca42097f1
parentd9de19b1cc013433ad293365b5b3902ec73dfd60
PM / OPP: Use snprintf() instead of sprintf()

sprintf() can access memory outside of the range of the character array,
and is risky in some situations. The driver specified prop_name string
can be longer than NAME_MAX here (only an attacker will do that though)
and so blindly copying it into the character array of size NAME_MAX
isn't safe. Instead we must use snprintf() here.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/opp/core.c
This page took 0.024821 seconds and 5 git commands to generate.