segfault on rfc2047-like subject

David Relson relson at osagesoftware.com
Sat Oct 9 00:36:33 CEST 2004


Matthias,

Here's the deal on the final NUL, i.e. the intent behind it.  Use of
word_t is supposed to use word.leng and not look beyond that number of
characters.  Having an extra byte (with value NUL) is a debugging
convenience.  It allows looking at the word.text as a "char *" (in gdb).

All allocations of word_t are supposed to use macro "D" (as in "len+D")
to allocate the extra byte and use macro "Z" (as in "Z(word.leng)") to
clear that byte.  With "#define DEBUG" enabled, the macros work with the
extra byte.  With "#define DEBUG" disabled, the macros are no-ops (not
allocating space or zeroing bytes).

I'll take a look at word_t generation later this evening or weekend and
see what I can find.

David



More information about the bogofilter-dev mailing list