Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Aug 2015 03:06:24 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r286269 - stable/10/usr.bin/wall
Message-ID:  <201508040306.t7436OGo058569@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Tue Aug  4 03:06:23 2015
New Revision: 286269
URL: https://svnweb.freebsd.org/changeset/base/286269

Log:
  MFC	r286102:
  Buffer overflow in wall(1).
  
  This affected syslogd, wall and talkd.
  Detected by FORTIFY_SOURCE GSoC (with clang).
  
  Submitted by:		Oliver Pinter
  Differential Revision:	https://reviews.freebsd.org/D3254
  Reviewed by:		delphij, jmg

Modified:
  stable/10/usr.bin/wall/ttymsg.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/wall/ttymsg.c
==============================================================================
--- stable/10/usr.bin/wall/ttymsg.c	Tue Aug  4 02:56:31 2015	(r286268)
+++ stable/10/usr.bin/wall/ttymsg.c	Tue Aug  4 03:06:23 2015	(r286269)
@@ -62,7 +62,7 @@ ttymsg(struct iovec *iov, int iovcnt, co
 	struct iovec localiov[7];
 	ssize_t left, wret;
 	int cnt, fd;
-	static char device[MAXNAMLEN] = _PATH_DEV;
+	char device[MAXNAMLEN] = _PATH_DEV;
 	static char errbuf[1024];
 	char *p;
 	int forked;
@@ -71,8 +71,8 @@ ttymsg(struct iovec *iov, int iovcnt, co
 	if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0])))
 		return ("too many iov's (change code in wall/ttymsg.c)");
 
+	strlcat(device, line, sizeof(device));
 	p = device + sizeof(_PATH_DEV) - 1;
-	strlcpy(p, line, sizeof(device));
 	if (strncmp(p, "pts/", 4) == 0)
 		p += 4;
 	if (strchr(p, '/') != NULL) {



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