lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <m6fDuYqgCI0Sg6QMnrYRG8MnGc1yujAoq2vOkZiGDI4OwsQXSRKwLf_i3Ekb71lKsIKS3IUhzLsQM6gwn9X_bpChsnApJp2TggjbHdXctdw=@protonmail.com>
Date: Wed, 23 Apr 2025 07:12:05 +0000
From: Abanoub Sameh <abanoubsameh@...tonmail.com>
To: "maarten.lankhorst@...ux.intel.com" <maarten.lankhorst@...ux.intel.com>
Cc: "mripard@...nel.org" <mripard@...nel.org>, "tzimmermann@...e.de" <tzimmermann@...e.de>, "airlied@...il.com" <airlied@...il.com>, "simona@...ll.ch" <simona@...ll.ch>, "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Patch to replace strcpy() with strscpy() in drm_fb_helper.c

>From e45e4d9016262ace19db01e69d266d6218789ccd Mon Sep 17 00:00:00 2001
From: Abanoub Sameh <abanoubsameh@...tonmail.com>
Date: Thu, 17 Apr 2025 23:37:21 +0200
Subject: [PATCH] Use strscpy() instead of strcpy() in
 drivers/gpu/drm/drm_fb_helper.c

Use strscpy() instead of strcpy() since it is safer, and compliant with checkpatch.pl

It is an easy fix, since the size of fb_helper->fb->comm is a constant defined at linux/sched.h

strcpy() does not check for destination size and should not be used, see:
https://github.com/KSPP/linux/issues/88

Signed-off-by: Abanoub Sameh <abanoubsameh@...tonmail.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 937c3939e..4392aba01 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -33,6 +33,7 @@
 #include <linux/pci.h>
 #include <linux/sysrq.h>
 #include <linux/vga_switcheroo.h>
+#include <linux/sched.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_drv.h>
@@ -1650,7 +1651,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper)
 	if (ret < 0)
 		return ret;
 
-	strcpy(fb_helper->fb->comm, "[fbcon]");
+	strscpy(fb_helper->fb->comm, "[fbcon]", TASK_COMM_LEN);
 
 	info = fb_helper->info;
 
-- 
2.49.0



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ