diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-24 15:48:55 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-24 15:48:55 +0000 |
commit | a706d0e39b4548e52296a6a5bf49891343259c74 (patch) | |
tree | ce32c29fc4c861aa58fca73328e95cfe60e49bb7 | |
parent | d18fba75b622b4f60f75e73d697a3d20a2c226a0 (diff) | |
download | rspamd-a706d0e39b4548e52296a6a5bf49891343259c74.tar.gz rspamd-a706d0e39b4548e52296a6a5bf49891343259c74.zip |
Add sanity detection for header name
-rw-r--r-- | src/libmime/mime_expressions.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c index 57275e004..4bfc6c0f1 100644 --- a/src/libmime/mime_expressions.c +++ b/src/libmime/mime_expressions.c @@ -634,9 +634,20 @@ set: /* Register new item in the cache */ if (mime_atom->d.re->type == RSPAMD_RE_HEADER || mime_atom->d.re->type == RSPAMD_RE_RAWHEADER) { - rspamd_re_cache_add (cfg->re_cache, mime_atom->d.re->regexp, - mime_atom->d.re->type, mime_atom->d.re->header, - strlen (mime_atom->d.re->header) + 1); + if (mime_atom->d.re->header != NULL) { + rspamd_re_cache_add (cfg->re_cache, mime_atom->d.re->regexp, + mime_atom->d.re->type, mime_atom->d.re->header, + strlen (mime_atom->d.re->header) + 1); + } + else { + /* We have header regexp, but no header name is detected */ + g_set_error (err, + rspamd_mime_expr_quark (), + 200, + "no header name in /H regexp: '%s'", + mime_atom->str); + goto err; + } } else { rspamd_re_cache_add (cfg->re_cache, mime_atom->d.re->regexp, |