Skip to content

Commit 4e89a40

Browse files
Vladimir Moskovkinij-intel
authored andcommitted
platform/x86: dell-wmi-sysman: Avoid buffer overflow in current_password_store()
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: e8a60aa ("platform/x86: Introduce support for Systems Management Driver over WMI for Dell Systems") Cc: [email protected] Signed-off-by: Vladimir Moskovkin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent a7e255f commit 4e89a40

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static ssize_t current_password_store(struct kobject *kobj,
4545
int length;
4646

4747
length = strlen(buf);
48-
if (buf[length-1] == '\n')
48+
if (length && buf[length - 1] == '\n')
4949
length--;
5050

5151
/* firmware does verifiation of min/max password length,

0 commit comments

Comments
 (0)