mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-15 17:41:25 +00:00
charge_manager: fix possible out of bound read access
The port id given by the kernel is never checked and out-of-bound read accesses can be made on available_charge. Fix it. Change-Id: I06ed3d28c30db77d8256e9af808484a7cbdc901e Signed-off-by: Fabien Parent <fparent@baylibre.com> Reviewed-on: https://chromium-review.googlesource.com/1046592 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
7034d8b711
commit
e4b718df7a
@@ -1079,6 +1079,9 @@ static int hc_pd_power_info(struct host_cmd_handler_args *args)
|
||||
if (port == PD_POWER_CHARGING_PORT)
|
||||
port = charge_port;
|
||||
|
||||
if (port >= CHARGE_PORT_COUNT)
|
||||
return EC_RES_INVALID_PARAM;
|
||||
|
||||
charge_manager_fill_power_info(port, r);
|
||||
|
||||
args->response_size = sizeof(*r);
|
||||
|
||||
Reference in New Issue
Block a user