mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 20:14:06 +02:00
staging: nvec: Fix incorrect null termination of battery manufacturer
The battery manufacturer string was incorrectly null terminated using
bat_model instead of bat_manu. This could result in an unintended
write to the wrong field and potentially incorrect behavior.
fixe the issue by correctly null terminating the bat_manu string.
Fixes: 32890b9830 ("Staging: initial version of the nvec driver")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20250719080755.3954373-1-alok.a.tiwari@oracle.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a713222906
commit
a8934352ba
|
|
@ -194,7 +194,7 @@ static int nvec_power_bat_notifier(struct notifier_block *nb,
|
|||
break;
|
||||
case MANUFACTURER:
|
||||
memcpy(power->bat_manu, &res->plc, res->length - 2);
|
||||
power->bat_model[res->length - 2] = '\0';
|
||||
power->bat_manu[res->length - 2] = '\0';
|
||||
break;
|
||||
case MODEL:
|
||||
memcpy(power->bat_model, &res->plc, res->length - 2);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user