NUL termination
Matthias Andree
matthias.andree at gmx.de
Wed Jan 29 01:39:38 CET 2003
David Relson <relson at osagesoftware.com> writes:
> The lexer routines that work with the buffer use a byte count and don't
> stop on a NUL byte. I added the NUL byte because index() was going past
> the end of the buffer and segfaulting. My changes deliberately allow
> only size-1 bytes in the buffer so that the NUL byte can be stored at
> buffer[count] without going beyond the buffer. An alternate solution
> would be to use a length controlled version of index(). I think that
> would be overkill in this situation.
Given there is a solution in the ISO C standard, it comes for free. Its
name is memchr() and according to my manual page, it conforms to ISO C,
POSIX and is provided for by common implementations (BSD and SysV).
--
Matthias Andree
More information about the bogofilter-dev
mailing list