diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-12-30 20:40:06 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-12-30 20:40:06 +0000 |
commit | 5c4edef4864b9b2172dd7ca5fb57502652baf783 (patch) | |
tree | d22ea60decfa6ebe200d46639f0de1cf490e1f6a | |
parent | f07ea94e3586ffe0e8b20b31d970d476c0394b5a (diff) |
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@>.
-rw-r--r-- | usr.bin/mandoc/mandocdb.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c index 56cb00898a5..0ffbd15b602 100644 --- a/usr.bin/mandoc/mandocdb.c +++ b/usr.bin/mandoc/mandocdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mandocdb.c,v 1.133 2014/12/05 16:17:56 schwarze Exp $ */ +/* $OpenBSD: mandocdb.c,v 1.134 2014/12/30 20:40:05 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -842,6 +842,7 @@ filescan(const char *file) if (strlcpy(mlink->file, start, sizeof(mlink->file)) >= sizeof(mlink->file)) { say(start, "Filename too long"); + free(mlink); return; } |