summaryrefslogtreecommitdiff
path: root/bin/cat
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2014-01-11 15:01:30 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2014-01-11 15:01:30 +0000
commit4c766481d0ee902c5fcdb7f5dc3c70819387f890 (patch)
tree50659571a7a204cd104eb767d614542c04b7531a /bin/cat
parentf1575af8e404f8105842ab1d32da5eb70988e1f8 (diff)
downloadsrc-test-4c766481d0ee902c5fcdb7f5dc3c70819387f890.tar.gz
src-test-4c766481d0ee902c5fcdb7f5dc3c70819387f890.zip
Close the newly-created FD if the pathname is too long.
Coverity: CID 1007204 Sponsored by: Netflix, Inc.
Notes
Notes: svn path=/head/; revision=260544
Diffstat (limited to 'bin/cat')
-rw-r--r--bin/cat/cat.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/bin/cat/cat.c b/bin/cat/cat.c
index 0daac7caec704..f724cb0b8b9a8 100644
--- a/bin/cat/cat.c
+++ b/bin/cat/cat.c
@@ -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);
}