1 Jan 2006 02:59
sysctl: make sure to terminate strings with a NUL
Linux Kernel Mailing List <linux-kernel <at> vger.kernel.org>
2006-01-01 01:59:28 GMT
2006-01-01 01:59:28 GMT
tree ef7805d1e03e8648fbaca3713d1a749c27770339
parent 35f349ee082de0be45eb23926d9fc7569f5011f0
author Linus Torvalds <torvalds <at> g5.osdl.org> Sun, 01 Jan 2006 09:00:29 -0800
committer Linus Torvalds <torvalds <at> g5.osdl.org> Sun, 01 Jan 2006 09:00:29 -0800
sysctl: make sure to terminate strings with a NUL
This is a slightly more complete fix for the previous minimal sysctl
string fix. It always terminates the returned string with a NUL, even
if the full result wouldn't fit in the user-supplied buffer.
The returned length is the full untruncated length, so that you can
tell when truncation has occurred.
Signed-off-by: Linus Torvalds <torvalds <at> osdl.org>
kernel/sysctl.c | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index e5102ea..b53115b 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
<at> <at> -2192,27 +2192,32 <at> <at> int sysctl_string(ctl_table *table, int
void __user *oldval, size_t __user *oldlenp,
void __user *newval, size_t newlen, void **context)
{
- size_t l, len;
-
if (!table->data || !table->maxlen)
(Continue reading)
RSS Feed