* [PATCH] platform/x86: dell-wmi-sysman: Avoid buffer overflow in current_password_store()
@ 2025-05-14 12:12 Vladimir Moskovkin
2025-05-15 11:52 ` Ilpo Järvinen
0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Moskovkin @ 2025-05-14 12:12 UTC (permalink / raw)
To: Prasanth Ksr
Cc: Hans de Goede, Ilpo Järvinen, Mario Limonciello,
Divya Bharathi, Dell.Client.Kernel, platform-driver-x86,
linux-kernel, stable, lvc-project
If the 'buf' array received from the user contains an empty string, the
'length' variable will be zero. Accessing the 'buf' array element with
index 'length - 1' will result in a buffer overflow.
Add a check for an empty string.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: e8a60aa7404b ("platform/x86: Introduce support for Systems Management Driver over WMI for Dell Systems")
Cc: stable@vger.kernel.org
Signed-off-by: Vladimir Moskovkin <Vladimir.Moskovkin@kaspersky.com>
---
drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c b/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c
index 230e6ee96636..d8f1bf5e58a0 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c
@@ -45,7 +45,7 @@ static ssize_t current_password_store(struct kobject *kobj,
int length;
length = strlen(buf);
- if (buf[length-1] == '\n')
+ if (length && buf[length - 1] == '\n')
length--;
/* firmware does verifiation of min/max password length,
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] platform/x86: dell-wmi-sysman: Avoid buffer overflow in current_password_store()
2025-05-14 12:12 [PATCH] platform/x86: dell-wmi-sysman: Avoid buffer overflow in current_password_store() Vladimir Moskovkin
@ 2025-05-15 11:52 ` Ilpo Järvinen
0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2025-05-15 11:52 UTC (permalink / raw)
To: Prasanth Ksr, Vladimir Moskovkin
Cc: Hans de Goede, Mario Limonciello, Divya Bharathi,
Dell.Client.Kernel, platform-driver-x86, linux-kernel, stable,
lvc-project
On Wed, 14 May 2025 12:12:55 +0000, Vladimir Moskovkin wrote:
> If the 'buf' array received from the user contains an empty string, the
> 'length' variable will be zero. Accessing the 'buf' array element with
> index 'length - 1' will result in a buffer overflow.
>
> Add a check for an empty string.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo-fixes branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/1] platform/x86: dell-wmi-sysman: Avoid buffer overflow in current_password_store()
commit: 4e89a4077490f52cde652d17e32519b666abf3a6
--
i.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-15 11:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-14 12:12 [PATCH] platform/x86: dell-wmi-sysman: Avoid buffer overflow in current_password_store() Vladimir Moskovkin
2025-05-15 11:52 ` Ilpo Järvinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®