net/virtio-user: fix string unterminated
authorJianfeng Tan <jianfeng.tan@intel.com>
Wed, 29 Jun 2016 09:05:36 +0000 (09:05 +0000)
committerYuanhan Liu <yuanhan.liu@linux.intel.com>
Tue, 5 Jul 2016 11:30:25 +0000 (13:30 +0200)
commit542849c09c2fc9dc4beed5e7e23a1dc2a3f40e86
tree17c48984a31725807a65ddec8c188b42c635baa5
parent14f06474b8b961f99d85028153155515dd38559c
net/virtio-user: fix string unterminated

When use strcpy() to copy string with length exceeding the last
parameter of strcpy(), it may lead to the destination string
unterminated.

We replaced strncpy with snprintf to make sure it's NULL terminated.

Coverity issue: 127476
Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
drivers/net/virtio/virtio_user/virtio_user_dev.c