Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Sep 2014 13:24:06 +0000 (UTC)
From:      Jean-Sebastien Pedron <dumbbell@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r271758 - head/sys/dev/vt
Message-ID:  <201409181324.s8IDO6du035380@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dumbbell
Date: Thu Sep 18 13:24:06 2014
New Revision: 271758
URL: http://svnweb.freebsd.org/changeset/base/271758

Log:
  vt(4): Use strncpy() to copy into a fixed-size buffer
  
  CID:		1230007
  MFC after:	3 days

Modified:
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_core.c
==============================================================================
--- head/sys/dev/vt/vt_core.c	Thu Sep 18 13:00:03 2014	(r271757)
+++ head/sys/dev/vt/vt_core.c	Thu Sep 18 13:24:06 2014	(r271758)
@@ -796,7 +796,8 @@ vt_allocate_keyboard(struct vt_device *v
 				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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409181324.s8IDO6du035380>