[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241204064149.218136-1-15074444048@163.com>
Date: Wed, 4 Dec 2024 14:41:49 +0800
From: 15074444048@....com
To: linux-hardening@...r.kernel.org,
kees@...nel.org
Cc: 15074444048@....com,
lihaojie <lihaojie@...inos.cn>
Subject: [PATCH] fortify: Use __struct_size replace __member_size
From: lihaojie <lihaojie@...inos.cn>
Use __struct_size get destination size.
Size of destination less of the size to be written will
make buffer overflow, the size of destination should be
complete.
Signed-off-by: lihaojie <lihaojie@...inos.cn>
---
include/linux/fortify-string.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h
index 0d99bf11d260..0504b2c8aab7 100644
--- a/include/linux/fortify-string.h
+++ b/include/linux/fortify-string.h
@@ -277,7 +277,7 @@ extern ssize_t __real_strscpy(char *, const char *, size_t) __RENAME(sized_strsc
__FORTIFY_INLINE ssize_t sized_strscpy(char * const POS p, const char * const POS q, size_t size)
{
/* Use string size rather than possible enclosing struct size. */
- const size_t p_size = __member_size(p);
+ const size_t p_size = __struct_size(p);
const size_t q_size = __member_size(q);
size_t len;
--
2.25.1
Powered by blists - more mailing lists