Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jan 2014 15:01:30 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r260544 - head/bin/cat
Message-ID:  <201401111501.s0BF1U3x005172@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sat Jan 11 15:01:30 2014
New Revision: 260544
URL: http://svnweb.freebsd.org/changeset/base/260544

Log:
  Close the newly-created FD if the pathname is too long.
  
  Coverity:	CID 1007204
  Sponsored by:	Netflix, Inc.

Modified:
  head/bin/cat/cat.c

Modified: head/bin/cat/cat.c
==============================================================================
--- head/bin/cat/cat.c	Sat Jan 11 14:56:04 2014	(r260543)
+++ head/bin/cat/cat.c	Sat Jan 11 15:01:30 2014	(r260544)
@@ -316,6 +316,7 @@ udom_open(const char *path, int flags)
 		sou.sun_family = AF_UNIX;
 		if ((len = strlcpy(sou.sun_path, path,
 		    sizeof(sou.sun_path))) >= sizeof(sou.sun_path)) {
+			close(fd);
 			errno = ENAMETOOLONG;
 			return (-1);
 		}



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