diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-11-15 16:40:54 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-11-15 16:40:54 +0000 |
commit | 803a9062065ccf7a3dde90db5adb872e86d4be5b (patch) | |
tree | db7f65cab8aefd1250951ff21b10505ae1ae7b04 /src/libserver/protocol.c | |
parent | 7f62d657cea4e50d65dc6be53cb091774b540da3 (diff) | |
download | rspamd-803a9062065ccf7a3dde90db5adb872e86d4be5b.tar.gz rspamd-803a9062065ccf7a3dde90db5adb872e86d4be5b.zip |
[Project] Use own utf8 validation instead of glib
Diffstat (limited to 'src/libserver/protocol.c')
-rw-r--r-- | src/libserver/protocol.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index 0786f4860..c457fc455 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -26,6 +26,7 @@ #include "unix-std.h" #include "protocol_internal.h" #include "libserver/mempool_vars_internal.h" +#include "contrib/fastutf8/fastutf8.h" #include "task.h" #include <math.h> @@ -922,16 +923,13 @@ urls_protocol_cb (gpointer key, gpointer value, gpointer ud) return; } - const gchar *end = NULL; + goffset err_offset; - if (g_utf8_validate (url->host, url->hostlen, &end)) { + if ((err_offset = rspamd_fast_utf8_validate (url->host, url->hostlen) == 0)) { obj = ucl_object_fromlstring (url->host, url->hostlen); } - else if (end - url->host > 0) { - obj = ucl_object_fromlstring (url->host, end - url->host); - } else { - return; + obj = ucl_object_fromlstring (url->host, err_offset); } } else { |