disp: msm: sde: Add change to fix slab out of bounds

Non null terminated string from user space can cause out
of bound access issue. Hence added a NULL character
explicitly in name when received from user space.

Change-Id: I6d498f16a59ec2832ddc0951952101859666eacf
Signed-off-by: yadwan <quic_yadwan@quicinc.com>
(cherry picked from commit 7eb70ce3648b8eb8e5340b0bf3c5bb3a7605d811)
This commit is contained in:
yadwan 2025-07-29 11:04:00 +08:00 • committed by Prasad Valavala
commit 6bbef66ce3

View file

@ -204,6 +204,8 @@ int sde_wb_connector_set_modes(struct sde_wb_device *wb_dev,
memset(&dispmode, 0, sizeof(dispmode));
ret = drm_mode_convert_umode(wb_dev->drm_dev,
&dispmode, &modeinfo[i]);
/* null terminate the string */
modeinfo[i].name[DRM_DISPLAY_MODE_LEN - 1] = '\0';
if (ret) {
SDE_ERROR(
"failed to convert mode %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x status:%d rc:%d\n",