代码拉取完成,页面将自动刷新
From c85de5ac34af143ffb30bcaffcf6f54029d60dbf Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <[email protected]>
Date: Thu, 18 Jul 2024 13:01:00 +0200
Subject: [PATCH 57/85] checkpatch.pl: warn also about strcat and sprintf
usages
strcpy, strncpy and sprintf aren't safe, as they don't check
buffer overflows. Change the checkpatch logic to warn about
such usages.
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
scripts/checkpatch.pl | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e81e509..7ed2ec6 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6675,10 +6675,10 @@ sub process {
# }
# }
-# strcpy should be avoided
- if ($line =~ /\bstrcpy\s*\(/) {
+# strcpy and strcat should be avoided
+ if ($line =~ /\b(strcpy|strcat|sprintf)\s*\(/) {
WARN("STRCPY",
- "Please avoid strcpy\n" . $herecurr);
+ "Please avoid $1 as it doesn't check buffer size\n" . $herecurr);
}
# ethtool_sprintf uses that should likely be ethtool_puts
--
2.33.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。