Browse Source

[Fix] Fix utf8 validation for symbols options and empty strings

tags/2.2
Vsevolod Stakhov 4 years ago
parent
commit
e7059c97ee
2 changed files with 6 additions and 2 deletions
  1. 1
    1
      src/libmime/scan_result.c
  2. 5
    1
      src/libutil/str_util.c

+ 1
- 1
src/libmime/scan_result.c View File

@@ -529,7 +529,7 @@ rspamd_task_add_result_option (struct rspamd_task *task,

vlen = strlen (val);

if (!rspamd_fast_utf8_validate (val, vlen)) {
if (rspamd_fast_utf8_validate (val, vlen) == 0) {
opt_cpy = rspamd_str_make_utf_valid (val, vlen, &vlen,
task->task_pool);
val = opt_cpy;

+ 5
- 1
src/libutil/str_util.c View File

@@ -3067,7 +3067,11 @@ rspamd_str_make_utf_valid (const guchar *src, gsize slen,
}

if (slen == 0) {
return NULL;
if (dstlen) {
*dstlen = 0;
}

return pool ? rspamd_mempool_strdup (pool, "") : g_strdup ("");
}

p = src;

Loading…
Cancel
Save