From ec4f1f2cda63931d3a7ef0214cce8c0bd80f3f98 Mon Sep 17 00:00:00 2001 From: dumbbell Date: Thu, 18 Sep 2014 13:24:06 +0000 Subject: [PATCH] vt(4): Use strncpy() to copy into a fixed-size buffer CID: 1230007 MFC after: 3 days --- sys/dev/vt/vt_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 62e5c48f8e14..f9e6b257a70a 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -796,7 +796,8 @@ vt_allocate_keyboard(struct vt_device *vd) continue; bzero(&ki, sizeof(ki)); - strcpy(ki.kb_name, k->kb_name); + strncpy(ki.kb_name, k->kb_name, sizeof(ki.kb_name)); + ki.kb_name[sizeof(ki.kb_name) - 1] = '\0'; ki.kb_unit = k->kb_unit; kbdd_ioctl(k0, KBADDKBD, (caddr_t) &ki);