commit 76e216d: [Minor] Fix regexp parsing bug

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Jul 17 09:07:05 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-07-17 10:00:32 +0100
URL: https://github.com/rspamd/rspamd/commit/76e216dd05fdb02001f0107b54cff92a694a1e16 (HEAD -> master)

[Minor] Fix regexp parsing bug

---
 src/libutil/regexp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index e9934083d..700b595c1 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -331,12 +331,12 @@ rspamd_regexp_new_len (const gchar *pattern, gsize len, const gchar *flags,
 		return NULL;
 	}
 
-	if (flags == NULL && start < end) {
+	if (flags == NULL && start + 1 < end) {
 		/* We need to parse pattern and detect flags set */
 		if (*start == '/') {
 			sep = '/';
 		}
-		else if (*start == 'm') {
+		else if (*start == 'm' && !g_ascii_isalnum(start[1])) {
 			start ++;
 			sep = *start;
 


More information about the Commits mailing list