const gchar *what, gsize len)
{
rspamd_regexp_t *re;
- gint r;
+ gint r = 0;
if (arg->type == EXPRESSION_ARGUMENT_REGEXP) {
/* This is a regexp */
}
- r = rspamd_regexp_search (re, what, len, NULL, NULL, FALSE, NULL);
+ if (len > 0) {
+ r = rspamd_regexp_search (re, what, len, NULL, NULL, FALSE, NULL);
+ }
return r;
}
DL_FOREACH (found, cur) {
if (arg_pattern->type == EXPRESSION_ARGUMENT_REGEXP) {
re = arg_pattern->data;
- r = rspamd_regexp_search (re,
- cur->value.begin, cur->value.len,
- NULL, NULL, FALSE, NULL);
+
+ if (cur->value.len > 0) {
+ r = rspamd_regexp_search (re,
+ cur->value.begin, cur->value.len,
+ NULL, NULL, FALSE, NULL);
+ }
if (r) {
return TRUE;
rspamd_regexp_t *re;
struct expression_argument *arg1, *arg_pattern;
struct rspamd_content_type *ct;
- gint r;
+ gint r = 0;
guint i;
gboolean recursive = FALSE;
struct rspamd_mime_part *cur_part;
if (arg_pattern->type == EXPRESSION_ARGUMENT_REGEXP) {
re = arg_pattern->data;
- r = rspamd_regexp_search (re, param_data->begin, param_data->len,
- NULL, NULL, FALSE, NULL);
+
+ if (param_data->len > 0) {
+ r = rspamd_regexp_search (re, param_data->begin, param_data->len,
+ NULL, NULL, FALSE, NULL);
+ }
if (r) {
return TRUE;
}
if (subtype->type == EXPRESSION_ARGUMENT_REGEXP) {
re = subtype->data;
- r = rspamd_regexp_search (re, ct->subtype.begin, ct->subtype.len,
- NULL, NULL, FALSE, NULL);
+
+ if (ct->subtype.len > 0) {
+ r = rspamd_regexp_search (re, ct->subtype.begin, ct->subtype.len,
+ NULL, NULL, FALSE, NULL);
+ }
}
else {
srch.begin = subtype->data;
struct rspamd_mime_part *part;
struct rspamd_content_type *ct;
rspamd_ftok_t srch;
- gint r;
+ gint r = 0;
guint i;
for (i = 0; i < task->parts->len; i ++) {
if (param_type->type == EXPRESSION_ARGUMENT_REGEXP) {
re = param_type->data;
- r = rspamd_regexp_search (re, ct->type.begin, ct->type.len,
- NULL, NULL, FALSE, NULL);
+ if (ct->type.len > 0) {
+ r = rspamd_regexp_search (re, ct->type.begin, ct->type.len,
+ NULL, NULL, FALSE, NULL);
+ }
+
/* Also check subtype and length of the part */
if (r && param_subtype) {
r = compare_len (part, min_len, max_len) &&