From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp1.rz.uni-karlsruhe.de (Debian-exim@smtp1.rz.uni-karlsruhe.de [129.13.185.217]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id o9QLmefv028142 for ; Tue, 26 Oct 2010 17:48:42 -0400 (EDT) Received: from hekate.usta.de (asta-nat.asta.uni-karlsruhe.de [172.22.63.82]) by smtp1.rz.uni-karlsruhe.de with esmtp (Exim 4.63 #1) id 1PArNm-0006NW-Rx; Tue, 26 Oct 2010 23:48:38 +0200 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.71) (envelope-from ) id 1PArNm-0003ek-MY for tech@mdocml.bsd.lv; Tue, 26 Oct 2010 23:48:38 +0200 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.69) (envelope-from ) id 1PArNm-0001H0-L3 for tech@mdocml.bsd.lv; Tue, 26 Oct 2010 23:48:38 +0200 Received: from schwarze by usta.de with local (Exim 4.71) (envelope-from ) id 1PArNm-0001Zz-AJ for tech@mdocml.bsd.lv; Tue, 26 Oct 2010 23:48:38 +0200 Date: Tue, 26 Oct 2010 23:48:38 +0200 From: Ingo Schwarze To: tech@mdocml.bsd.lv Subject: Re: implement .so Message-ID: <20101026214838.GH27536@iris.usta.de> References: <20101024172914.GH20876@iris.usta.de> <20101024173857.GA18657@britannica.bec.de> <20101024180019.GI20876@iris.usta.de> <20101024181502.GA13039@britannica.bec.de> <20101024194129.GJ20876@iris.usta.de> <20101024195135.GA1809@britannica.bec.de> <20101025215506.GA12557@iris.usta.de> <20101025221017.GA6533@britannica.bec.de> <20101026175913.GF27536@iris.usta.de> <20101026181252.GA4964@britannica.bec.de> X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101026181252.GA4964@britannica.bec.de> User-Agent: Mutt/1.5.20 (2009-06-14) Hi Joerg, Thanks for your quick feedback! Joerg Sonnenberger wrote on Tue, Oct 26, 2010 at 08:12:52PM +0200: > I would like to a see a warning for -T lint, but I am not sure how that > could be implemented easily. I think i know how to put that in, it doesn't seem like any kind of a problem. But i'd rather do that after committing the ERROR cleanup i posted recently, or it will conflict badly. > On Tue, Oct 26, 2010 at 07:59:13PM +0200, Ingo Schwarze wrote: >> +roff_so(ROFF_ARGS) >> +{ >> + char *name; >> + >> + name = *bufp + pos; >> + if ('/' == *name || strstr(name, "../") || strstr(name, "/..")) { >> + (*r->msg)(MANDOCERR_SOPATH, r->data, ln, pos, NULL); >> + return(ROFF_ERR); >> + } > Not sure I like the double use of strstr. > What about searching for the rare ".." first? Admittedly, that would allow to reduce the algorithm order from O(2N) to O(N), where N is the length of the name of the included file, so not exactly a large number. Given that you almost never have more than one .so per file, i consider readability of the code more important here than economizing typically about 20 character comparisons. So, i think i will put in the pdesc refactoring, then .so, then the ERROR cleanup, then add a warning message. OK? Yours, Ingo -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv