From: Vsevolod Stakhov Date: Mon, 20 Jul 2009 16:02:43 +0000 (+0400) Subject: * Use g_ascii_isalnum for more strict decoding X-Git-Tag: 0.2.7~79 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1094cced952ce0565dde55c75f318124d0f84f3e;p=rspamd.git * Use g_ascii_isalnum for more strict decoding * Keep undecoded entitles undecoded * Fix log message --- diff --git a/src/html.c b/src/html.c index 84db67d80..363512df1 100644 --- a/src/html.c +++ b/src/html.c @@ -286,9 +286,10 @@ decode_entitles (char *s) case 1: if (*h == ';') { val = strtoul ((t + 2), &end_ptr, 10); - if ((end_ptr != NULL && *end_ptr != ';') || val < 0 || val > 128) { - msg_info ("decode_entitles: invalid entitle code, cannot convert, %d", val); - *t = 'U'; + if ((end_ptr != NULL && *end_ptr != ';') || !g_ascii_isalnum ((char)val)) { + msg_info ("decode_entitles: invalid entitle code, cannot convert, strtoul returned %d", val); + /* Skip undecoded */ + t = h; } else { *t = (char)val;