summaryrefslogtreecommitdiffstats
path: root/bin/cat
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2014-01-11 15:01:30 +0000
committeradrian <adrian@FreeBSD.org>2014-01-11 15:01:30 +0000
commit60ae67a42bc62b95575cea65e6bf52fbac578fd8 (patch)
tree50659571a7a204cd104eb767d614542c04b7531a /bin/cat
parent9c156ba746d659c3c11617875a44c7473ab2c5be (diff)
downloadFreeBSD-src-60ae67a42bc62b95575cea65e6bf52fbac578fd8.zip
FreeBSD-src-60ae67a42bc62b95575cea65e6bf52fbac578fd8.tar.gz
Close the newly-created FD if the pathname is too long.
Coverity: CID 1007204 Sponsored by: Netflix, Inc.
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 0daac7c..f724cb0 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);
}
OpenPOWER on IntegriCloud