media: atomisp: gmin_platform: fix out_len in gmin_get_config_dsm_var()
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 26 May 2023 11:53:23 +0000 (12:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jul 2023 14:21:54 +0000 (16:21 +0200)
commitd199218881d7882442819e3c93c61e161ead6deb
tree33264a4a12cb6bed355d571778a2131047080abc
parentc8470b7de8b44d083378f9cac44faa18c7464050
media: atomisp: gmin_platform: fix out_len in gmin_get_config_dsm_var()

[ Upstream commit 1657f2934daf89e8d9fa4b2697008909eb22c73e ]

Ideally, strlen(cur->string.pointer) and strlen(out) would be the same.
But this code is using strscpy() to avoid a potential buffer overflow.
So in the same way we should take the strlen() of the smaller string to
avoid a buffer overflow in the caller, gmin_get_var_int().

Link: https://lore.kernel.org/r/26124bcd-8132-4483-9d67-225c87d424e8@kili.mountain
Fixes: 387041cda44e ("media: atomisp: improve sensor detection code to use _DSM table")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c