From: schwarze Date: Tue, 30 Dec 2014 20:40:05 +0000 (+0000) Subject: When a file is given on the command line, actually exists, and its name X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ad6020cd466bb35c0d86e93cefda3c6066b4e34c;p=openbsd 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 . --- 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 * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze @@ -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; }