aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sys.c')
-rw-r--r--kernel/sys.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index d5b79f65ad9b..558b035965aa 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1350,7 +1350,8 @@ asmlinkage long sys_sethostname(char __user *name, int len)
1350 errno = -EFAULT; 1350 errno = -EFAULT;
1351 if (!copy_from_user(tmp, name, len)) { 1351 if (!copy_from_user(tmp, name, len)) {
1352 memcpy(utsname()->nodename, tmp, len); 1352 memcpy(utsname()->nodename, tmp, len);
1353 utsname()->nodename[len] = 0; 1353 memset(utsname()->nodename + len, 0,
1354 sizeof(utsname()->nodename) - len);
1354 errno = 0; 1355 errno = 0;
1355 } 1356 }
1356 up_write(&uts_sem); 1357 up_write(&uts_sem);
@@ -1396,7 +1397,8 @@ asmlinkage long sys_setdomainname(char __user *name, int len)
1396 errno = -EFAULT; 1397 errno = -EFAULT;
1397 if (!copy_from_user(tmp, name, len)) { 1398 if (!copy_from_user(tmp, name, len)) {
1398 memcpy(utsname()->domainname, tmp, len); 1399 memcpy(utsname()->domainname, tmp, len);
1399 utsname()->domainname[len] = 0; 1400 memset(utsname()->domainname + len, 0,
1401 sizeof(utsname()->domainname) - len);
1400 errno = 0; 1402 errno = 0;
1401 } 1403 }
1402 up_write(&uts_sem); 1404 up_write(&uts_sem);