commit 66d8ff3: [Minor] Fix another extreme case

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Jul 17 09:14:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-07-17 10:07:14 +0100
URL: https://github.com/rspamd/rspamd/commit/66d8ff3b6b07343c31dc66c2db8720c912302bf0 (HEAD -> master)

[Minor] Fix another extreme case

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

diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index 700b595c1..584c0c5c9 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -309,7 +309,7 @@ rspamd_regexp_t*
 rspamd_regexp_new_len (const gchar *pattern, gsize len, const gchar *flags,
 		GError **err)
 {
-	const gchar *start = pattern, *end = start + len, *flags_str = NULL, *flags_end;
+	const gchar *start = pattern, *end = start + len, *flags_str = NULL, *flags_end = NULL;
 	gchar *err_str;
 	rspamd_regexp_t *res;
 	gboolean explicit_utf = FALSE;
@@ -372,7 +372,9 @@ rspamd_regexp_new_len (const gchar *pattern, gsize len, const gchar *flags,
 		strict_flags = TRUE;
 		start = pattern;
 		flags_str = flags;
-		flags_end = flags + strlen(flags);
+		if (flags) {
+			flags_end = flags + strlen(flags);
+		}
 	}
 
 	rspamd_flags |= RSPAMD_REGEXP_FLAG_RAW;


More information about the Commits mailing list