[PATCH] lexer fix for nulls in input stream, second attempt!

Allyn Fratkin allyn at fratkin.com
Sun Oct 20 09:19:13 CEST 2002


this is try #2 for the lexer null fix.  i have fixed the potential
buffer overflow issue, incorporated Matthias' suggestion of
using "!= EOF", added some error checking.

Matthias also suggested using getc instead of fgetc because it might be
faster.  i considered getc but decided not to use it because of the
following wording in the manual:
getc()  is equivalent to fgetc() except that it may be implemented as a
         macro which evaluates stream more than once.

the macro part sounded good but i wasn't sure of all of the ramifications
of "evaluating the stream more than once".  if someone with more experience
in this area knows exactly what issues this could have and that they are not
sigificant, feel free to switch from fgetc to getc.

i welcome feedback and suggestions.

Allyn Fratkin wrote:

> this is a patch to lexer.l that reimplements fgets in order to translate
> nulls in the input stream into spaces.  imho, this seems like the best
> approach
> since having actual nulls in the input stream will confuse the string
> handling routines farther downstream (mentioned in bug#609897),
> and removing them seems like it might accidentally cause two words that
> should be separated to come together.
>
> this is intended to be a fix for bug#623784 which i submitted.
> it may be a fix for #609897 but that report was somewhat vague so
> i can't be sure this is enough.
>
> this is the first patch that i have submitted, if i have made any grave
> errors or process mistakes or stepped on any toes, please be gentle with
> me.  :-)

-- 
Allyn Fratkin             allyn at fratkin.com
Escondido, CA             http://www.fratkin.com/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: lexer.l.nullpatch
URL: <https://www.bogofilter.org/pipermail/bogofilter-dev/attachments/20021020/777f1cd3/attachment.ksh>


More information about the bogofilter-dev mailing list