From owner-freebsd-questions@FreeBSD.ORG Tue Jun 9 01:10:32 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C457310656A3 for ; Tue, 9 Jun 2009 01:10:32 +0000 (UTC) (envelope-from kline@thought.org) Received: from aristotle.thought.org (aristotle.thought.org [209.180.213.210]) by mx1.freebsd.org (Postfix) with ESMTP id 63EEA8FC18 for ; Tue, 9 Jun 2009 01:10:31 +0000 (UTC) (envelope-from kline@thought.org) Received: from thought.org (tao.thought.org [10.47.0.250]) (authenticated bits=0) by aristotle.thought.org (8.14.2/8.14.2) with ESMTP id n591BfOU078885; Mon, 8 Jun 2009 18:11:41 -0700 (PDT) (envelope-from kline@thought.org) Received: by thought.org (nbSMTP-1.00) for uid 1002 kline@thought.org; Mon, 8 Jun 2009 18:10:27 -0700 (PDT) Date: Mon, 8 Jun 2009 18:10:26 -0700 From: Gary Kline To: Glen Barber Message-ID: <20090609011026.GA7271@thought.org> References: <20090609001529.GA7166@thought.org> <4ad871310906081720p4fcb7c90s3780b230d45c5954@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4ad871310906081720p4fcb7c90s3780b230d45c5954@mail.gmail.com> User-Agent: Mutt/1.4.2.3i X-Organization: Thought Unlimited. Public service Unix since 1986. X-Of_Interest: With 22++ years of service to the Unix community. X-Spam-Status: No, score=-4.4 required=3.6 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on aristotle.thought.org Cc: FreeBSD Mailing List Subject: Re: flaw found.... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jun 2009 01:10:33 -0000 On Mon, Jun 08, 2009 at 08:20:22PM -0400, Glen Barber wrote: > Gary, > > On Mon, Jun 8, 2009 at 8:15 PM, Gary Kline wrote: > >        not surprisingly, i found a fla w in my getc(fp) program that > >        tried to read past "" ...  the example i added to my > >        test file was simply the 2 bytes "<" and "?".  so if you have a > >        stray > > > >        " > > >        with a matching close case, the binary hangs on a read. > >        so, again, can anybody suggest a better example, in C, to get > >        past two delimiters? > > > >        one thought is how gcc parses the "/*" and "*/" comment > >        delimiters.  any compiler gurus out there who know > >        where this code is? > > > >        gary > > > >        ? > > > > What about having it check a char array, similar to how programs like > ls(1) does checking for command line arguments? > > http://svn.freebsd.org/base/stable/7/bin/ls/ls.c - line 181 and on. > yes, this is one thing i was thinking about at around 04:30! having a pointer to both the beginning and ending of the delimiter pair. if no ending was found, issue a warning and error exit. FWIW, Google just pointed me at a snippet that showed how to get past things like "// comments...." thankee! > -- > Glen Barber > http://www.dev-urandom.com > http://www.linkedin.com/in/glenjbarber -- Gary Kline kline@thought.org http://www.thought.org Public Service Unix http://jottings.thought.org http://transfinite.thought.org For FBSD list: http://transfinite.thought.org/slicejourney.php The 4.91a release of Jottings: http://jottings.thought.org/index.php