Date: Mon, 8 Jun 2009 18:10:26 -0700 From: Gary Kline <kline@thought.org> To: Glen Barber <glen.j.barber@gmail.com> Cc: FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: flaw found.... Message-ID: <20090609011026.GA7271@thought.org> In-Reply-To: <4ad871310906081720p4fcb7c90s3780b230d45c5954@mail.gmail.com> References: <20090609001529.GA7166@thought.org> <4ad871310906081720p4fcb7c90s3780b230d45c5954@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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<kline@thought.org> wrote: > > not surprisingly, i found a fla w in my getc(fp) program that > > tried to read past "<?" and "?>" ... 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090609011026.GA7271>