From: Enrico Scholz Date: Fri, 24 Sep 2004 15:08:26 +0000 (+0000) Subject: use a better method to copy labels; formerly, bad parameters could X-Git-Tag: IPSENTINEL_VERSION_0_12~279 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3242ad836f0ad57c45cdeea0429e2cf74c701c34;p=util-vserver.git use a better method to copy labels; formerly, bad parameters could cause undefined behaviour git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@1713 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/util-vserver/lib/syscall_setvhiname-v13.hc b/util-vserver/lib/syscall_setvhiname-v13.hc index 4bee1ba..2d98099 100644 --- a/util-vserver/lib/syscall_setvhiname-v13.hc +++ b/util-vserver/lib/syscall_setvhiname-v13.hc @@ -34,7 +34,8 @@ vc_set_vhi_name_v13(xid_t xid, vc_uts_type type, char const *val, size_t len) } cmd.field = VHI_USER2KERNEL(type); - strncpy(cmd.name, val, sizeof(cmd.name)); + memcpy(cmd.name, val, len); + cmd.name[len] = '\0'; rc = vserver(VCMD_vx_set_vhi_name, CTX_USER2KERNEL(xid), &cmd); ENSC_FIX_IOCTL(rc);