{
const gchar *obrace, *ebrace, *p, *c;
gchar t, *databuf;
+ guint len;
struct rspamd_function_atom *res;
struct expression_argument arg;
GError *err = NULL;
}
else if (!g_ascii_isspace (t)) {
state = in_string;
- c = p;
+
+ if (t == '\'' || t == '\"') {
+ c = p + 1;
+ }
+ else {
+ c = p;
+ }
}
p ++;
break;
prev_state = in_regexp;
}
else if (t == ',' || p == ebrace) {
- databuf = g_malloc (p - c + 1);
- rspamd_strlcpy (databuf, c, p - c + 1);
+ len = p - c + 1;
+ databuf = g_malloc (len);
+ rspamd_strlcpy (databuf, c, len);
arg.type = EXPRESSION_ARGUMENT_REGEXP;
arg.data = rspamd_regexp_cache_create (NULL, databuf, NULL, &err);
}
g_array_append_val (res->args, arg);
+ state = got_comma;
}
p ++;
break;
prev_state = in_string;
}
else if (t == ',' || p == ebrace) {
- databuf = g_malloc (p - c + 1);
- rspamd_strlcpy (databuf, c, p - c + 1);
+ if (*(p - 1) == '\'' || *(p - 1) == '\"') {
+ len = p - c;
+ }
+ else {
+ len = p - c + 1;
+ }
+
+ databuf = g_malloc (len);
+ rspamd_strlcpy (databuf, c, len);
arg.type = EXPRESSION_ARGUMENT_NORMAL;
arg.data = databuf;
g_array_append_val (res->args, arg);
+ state = got_comma;
}
p ++;
break;
return FALSE;
}
- if (args) {
+ if (args->len >= 4) {
arg = &g_array_index (args, struct expression_argument, 3);
g_assert (arg->type == EXPRESSION_ARGUMENT_NORMAL);
max = strtoul (arg->data, NULL, 10);