aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-06-08 18:18:42 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-06-08 18:18:42 -0700
commitb717e21c49b783a1c2065a1179e2741e1096424b (patch)
treea2b00f3986dcd742752cfd7ec56bb9aa7350ddf1 /kernel
parent98218e92ae6a3dee34421dcb354e5540cb0cdc05 (diff)
downloadhistory-b717e21c49b783a1c2065a1179e2741e1096424b.tar.gz
[PATCH] fix uts sysctl write size
From: Andy Whitcroft <apw@shadowen.org> The sysctl interfaces for updating the uts entries such as hostname and domainname are using the wrong length for these buffers; they are hard coded to 64. Although safe, this artifically limits the size of these fields to one less than the true maximum. This generates an inconsistency between the various methods of update for these fields. # hostname 12345678901234567890123456789012345678901234567890123456789012345 hostname: name too long # hostname 1234567890123456789012345678901234567890123456789012345678901234 # hostname 1234567890123456789012345678901234567890123456789012345678901234 # sysctl -w kernel.hostname=1234567890123456789012345678901234567890123456789012345678901234567890 kernel.hostname = 1234567890123456789012345678901234567890123456789012345678901234567890 # hostname 123456789012345678901234567890123456789012345678901234567890123 # The error originates from the fact the handler for strings (proc_dostring) already allows for the string terminator. This patch corrects the limit, taking the oppotunity to convert to use of sizeof(). Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sysctl.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 97342142e24c74..1ec71378f7c34f 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -218,7 +218,7 @@ static ctl_table kern_table[] = {
.ctl_name = KERN_OSTYPE,
.procname = "ostype",
.data = system_utsname.sysname,
- .maxlen = 64,
+ .maxlen = sizeof(system_utsname.sysname),
.mode = 0444,
.proc_handler = &proc_doutsstring,
.strategy = &sysctl_string,
@@ -227,7 +227,7 @@ static ctl_table kern_table[] = {
.ctl_name = KERN_OSRELEASE,
.procname = "osrelease",
.data = system_utsname.release,
- .maxlen = 64,
+ .maxlen = sizeof(system_utsname.release),
.mode = 0444,
.proc_handler = &proc_doutsstring,
.strategy = &sysctl_string,
@@ -236,7 +236,7 @@ static ctl_table kern_table[] = {
.ctl_name = KERN_VERSION,
.procname = "version",
.data = system_utsname.version,
- .maxlen = 64,
+ .maxlen = sizeof(system_utsname.version),
.mode = 0444,
.proc_handler = &proc_doutsstring,
.strategy = &sysctl_string,
@@ -245,7 +245,7 @@ static ctl_table kern_table[] = {
.ctl_name = KERN_NODENAME,
.procname = "hostname",
.data = system_utsname.nodename,
- .maxlen = 64,
+ .maxlen = sizeof(system_utsname.nodename),
.mode = 0644,
.proc_handler = &proc_doutsstring,
.strategy = &sysctl_string,
@@ -254,7 +254,7 @@ static ctl_table kern_table[] = {
.ctl_name = KERN_DOMAINNAME,
.procname = "domainname",
.data = system_utsname.domainname,
- .maxlen = 64,
+ .maxlen = sizeof(system_utsname.domainname),
.mode = 0644,
.proc_handler = &proc_doutsstring,
.strategy = &sysctl_string,