[cvs] bogofilter/src lexer.c,1.114,1.115
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <m-...@us...> - 2005-01-24 12:26:30
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9183 Modified Files: lexer.c Log Message: Robustness: Two isspace() -> explicit set of characters conversions. Index: lexer.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/lexer.c,v retrieving revision 1.114 retrieving revision 1.115 diff -u -d -r1.114 -r1.115 --- lexer.c 9 Jan 2005 17:32:34 -0000 1.114 +++ lexer.c 24 Jan 2005 12:26:21 -0000 1.115 @@ -79,6 +79,8 @@ * Check for lines wholly composed of printable characters as they can * cause a scanner abort "input buffer overflow, can't enlarge buffer * because scanner uses REJECT" + * + * \bug this function must go, we need to fix the lexer */ static bool long_token(byte *buf, uint count) { @@ -229,14 +231,15 @@ buff->t.leng = 0; count = reader_getline(buff); yylineno += 1; - if (!isspace(buff->t.text[0])) + /* only check for LWSP-char (RFC-822) aka. WSP (RFC-2822), + * these only include SP and HTAB */ + if (buff->t.text[0] != ' ' + && buff->t.text[0] != '\t') return count; /* Check for empty line which terminates message header */ if (is_eol((char *)buff->t.text, count)) return count; } - -/* return EOF; */ } int buff_fill(buff_t *buff, size_t used, size_t need) @@ -395,7 +398,7 @@ if (adjacent) { tmp = txt; while (adjacent && tmp < end) { - if (isspace(*tmp)) + if (*tmp && strchr(" \t\r\n", *tmp)) tmp += 1; else adjacent = false; |