[cvs] bogofilter/src buff.h,1.21,1.22 buff.c,1.27,1.28
Matthias Andree
matthias.andree at gmx.de
Sat Jan 8 04:37:09 CET 2005
relson at users.sourceforge.net writes:
> +void buff_shift(buff_t *self, uint start, uint length)
> +{
> + /* Shift buffer contents to delete the specified segment. */
> + /* Implemented for deleting html comments. */
> +
> + BOGO_ASSERT(start + length <= self->t.leng,
> + "Invalid buff_shift() parameters.");
> +
> + memmove(self->t.text + start, self->t.text + start + length, self->t.leng - length);
> + self->t.leng -= length;
> + Z(self->t.text[self->t.leng]); /* for easier debugging - removable */
Watch out for them segfaults, I fixed one of these guys before in buffer
handling code. Better nuke the Z() macro here so it doesn't scribble
beyond the buffer.
--
Matthias Andree
More information about the bogofilter-dev
mailing list