svn commit: r299624 - stable/9/sys/dev/pty

Garrett Cooper ngie at FreeBSD.org
Fri May 13 08:42:23 UTC 2016


Author: ngie
Date: Fri May 13 08:42:21 2016
New Revision: 299624
URL: https://svnweb.freebsd.org/changeset/base/299624

Log:
  MFstable/10 r299623:
  
  MFC r298337:
  r298337 (by cem):
  
  pty(4): Use strlcpy to guarantee destination buffer isn't overrun
  
  The devtoname() name is strcpyed into a small stack buffer.  Sure, we always
  expect the name to be ttyXX (or ptyXX).  If that's the case, strlcpy() doesn't
  hurt.
  
  CID:		1006768

Modified:
  stable/9/sys/dev/pty/pty.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/pty/pty.c
==============================================================================
--- stable/9/sys/dev/pty/pty.c	Fri May 13 08:41:09 2016	(r299623)
+++ stable/9/sys/dev/pty/pty.c	Fri May 13 08:42:21 2016	(r299624)
@@ -67,7 +67,7 @@ ptydev_fdopen(struct cdev *dev, int ffla
 		return (EBUSY);
 
 	/* Generate device name and create PTY. */
-	strcpy(name, devtoname(dev));
+	strlcpy(name, devtoname(dev), sizeof(name));
 	name[0] = 't';
 
 	error = pts_alloc_external(fflags & (FREAD|FWRITE), td, fp, dev, name);


More information about the svn-src-stable-9 mailing list