commit b506d1b: [Minor] Allow 0 length in rspamd_regexp_match

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Aug 15 14:56:06 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-08-15 15:49:03 +0100
URL: https://github.com/rspamd/rspamd/commit/b506d1b725ad9a492c896b0394b033fbd957aaa5

[Minor] Allow 0 length in rspamd_regexp_match

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

diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index 8b35ea395..fa606273c 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -863,6 +863,10 @@ rspamd_regexp_match (rspamd_regexp_t *re, const gchar *text, gsize len,
 	g_assert (re != NULL);
 	g_assert (text != NULL);
 
+	if (len == 0 && text != NULL) {
+		len = strlen (text);
+	}
+
 	if (rspamd_regexp_search (re, text, len, &start, &end, raw, NULL)) {
 		if (start == text && end == text + len) {
 			return TRUE;


More information about the Commits mailing list