aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandocdb.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-12-30 20:41:00 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-12-30 20:41:00 +0000
commit3d673e1a84f7b7f238eeab1d52469fc06197bce1 (patch)
tree52c77358bf1adfc3bb923e8999d4b90df2002699 /mandocdb.c
parentf2bf5036897e1d0088721388e2ec0801bebfa074 (diff)
downloadmandoc-3d673e1a84f7b7f238eeab1d52469fc06197bce1.tar.gz
mandoc-3d673e1a84f7b7f238eeab1d52469fc06197bce1.tar.zst
mandoc-3d673e1a84f7b7f238eeab1d52469fc06197bce1.zip
When a file is given on the command line, actually exists, and its name
relative to the respective manual tree is longer than PATH_MAX, do not leak the memory allocated to hold the name. Not sure that can actually happen, but better safe than sorry. FreeBSD Coverity Scan CID 1261303, reported by Pedro Giffuni <pfg@>.
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mandocdb.c b/mandocdb.c
index a2fac202..fc5cdb85 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.179 2014/12/09 07:29:42 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.180 2014/12/30 20:41:00 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -852,6 +852,7 @@ filescan(const char *file)
if (strlcpy(mlink->file, start, sizeof(mlink->file)) >=
sizeof(mlink->file)) {
say(start, "Filename too long");
+ free(mlink);
return;
}