[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <ba3290e18f9867e110b77d058c3f8c7015bd868b.1578274288.git.liuyang34@xiaomi.com>
Date: Mon, 6 Jan 2020 09:56:18 +0800
From: liuyang34 <yangliuxm34@...il.com>
To: Paul Moore <paul@...l-moore.com>,
Stephen Smalley <sds@...ho.nsa.gov>,
Eric Paris <eparis@...isplace.org>, selinux@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: liuyang34 <liuyang34@...omi.com>
Subject: [PATCH] selinuxfs: use scnprinft to get real length in sel_read_class
as the return value of snprintf maybe over the size of TMPBUFLEN,
use scnprintf to instead of it
Signed-off-by: liuyang34 <liuyang34@...omi.com>
---
security/selinux/selinuxfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index ee94fa4..977c32d 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1672,7 +1672,7 @@ static ssize_t sel_read_class(struct file *file, char __user *buf,
{
unsigned long ino = file_inode(file)->i_ino;
char res[TMPBUFLEN];
- ssize_t len = snprintf(res, sizeof(res), "%d", sel_ino_to_class(ino));
+ ssize_t len = scnprintf(res, sizeof(res), "%d", sel_ino_to_class(ino));
return simple_read_from_buffer(buf, count, ppos, res, len);
}
--
2.7.4
Powered by blists - more mailing lists