aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-04 16:00:55 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-04 16:00:55 +0000
commit49731817d10c29646a6eaec17a63fc63a1ce93c7 (patch)
treeace271a346bc97254a65a4c44e4051c744f6707c /src
parent1ed6a2f0b92671f36848880d7db5dcdef82460f4 (diff)
downloadrspamd-49731817d10c29646a6eaec17a63fc63a1ce93c7.tar.gz
rspamd-49731817d10c29646a6eaec17a63fc63a1ce93c7.zip
Fix match behaviour.
Diffstat (limited to 'src')
-rw-r--r--src/lua/lua_regexp.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/lua/lua_regexp.c b/src/lua/lua_regexp.c
index 04f141fb3..84455280f 100644
--- a/src/lua/lua_regexp.c
+++ b/src/lua/lua_regexp.c
@@ -123,14 +123,23 @@ lua_regexp_create (lua_State *L)
}
}
else if (string[0] == 'm') {
- /* Special case for perl */
+ /* Special case for m */
slash = &string[1];
sep = *slash;
- slash = strrchr (string, sep);
- if (slash != NULL && slash > &string[1]) {
- flags_str = slash + 1;
- pattern = g_malloc (slash - string - 1);
- rspamd_strlcpy (pattern, string + 2, slash - string - 1);
+
+ if (sep == '\0' || g_ascii_isalnum (sep)) {
+ /* Not a special case */
+ }
+ else {
+ slash = strrchr (string, sep);
+ if (slash != NULL && slash > &string[1]) {
+ flags_str = slash + 1;
+ pattern = g_malloc (slash - string + 1);
+ pattern[0] = '^';
+ rspamd_strlcpy (pattern + 1, string + 2, slash - string - 1);
+ pattern[slash - string - 1] = '$';
+ pattern[slash - string] = '\0';
+ }
}
}
else {