From 3242ad836f0ad57c45cdeea0429e2cf74c701c34 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Fri, 24 Sep 2004 15:08:26 +0000 Subject: [PATCH] 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 --- util-vserver/lib/syscall_setvhiname-v13.hc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 1.8.1.5